Re: does "select count(*) from mytable" always do a seq
От | Bruno Wolff III |
---|---|
Тема | Re: does "select count(*) from mytable" always do a seq |
Дата | |
Msg-id | 20050110163446.GA30793@wolff.to обсуждение исходный текст |
Ответ на | Re: does "select count(*) from mytable" always do a seq (Alex Turner <armtuk@gmail.com>) |
Ответы |
Re: does "select count(*) from mytable" always do a seq
|
Список | pgsql-general |
On Mon, Jan 10, 2005 at 10:26:46 -0500, Alex Turner <armtuk@gmail.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.
В списке pgsql-general по дате отправления: