From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | alex(at)neteconomist(dot)com |
Cc: | Scott Ribe <scott_ribe(at)killerbytes(dot)com>, Postgresql-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: does "select count(*) from mytable" always do a seq |
Date: | 2005-01-10 16:34:46 |
Message-ID: | 20050110163446.GA30793@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Jan 10, 2005 at 10:26:46 -0500,
Alex Turner <armtuk(at)gmail(dot)com> wrote:
> Forgive my ignorance, but I'm still learning about much of this stuff.
> If you perform:
>
> select an_id, int_value from my_table where int_value>400;
>
> The table has an index on int_value and there are enough rows to
> warrant using it. Doesn't the database perform in index scan on
> int_value followed by a retrieve for the datablocks with relavent oids
> to get the an_id field?
I don't think that oids are used in the process, but if the planner thinks
an index scan would be better it will use one.
> If another transaction has inserted rows into this table, won't the
> index have been updated, and contain new row references? Does this
> imply that the database must retrieve the row information to determine
> if the row is a row from a different transaction?
When doing an index scan, the heap tuples still need to be checked for
visibility to the current transaction.
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Turner | 2005-01-10 16:51:51 | Re: does "select count(*) from mytable" always do a seq |
Previous Message | Brendan Jurd | 2005-01-10 16:28:08 | Function for retreiving datatype |