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 20050110172342.GA3855@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  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
On Mon, Jan 10, 2005 at 11:51:51 -0500,
  Alex Turner <armtuk@gmail.com> wrote:
> I'm no database writing guru, but wouldn't it just be a matter of
> adding a transaction number to an index entry so as to determine it's
> newness and only retrieve entries with an older transaction number?

No, because transactions don't complete in the order they are started.
So you will need to be able to maintain some kind of list to cover
exceptions.

> I'm guessing that the theory is that most insert transactions will be
> committed, or only contain a small number of rows relative to the
> overall size of the table, and therefore the extra overhead of
> checking newer tuples won't impact the overall performance that much?
>
> I know I'm asking kind of deep questions that really don't affect much
> of anything, but I'm a devilishly curious individual, and I like
> understanding things that I use well.  Feel free to tell me that it's
> irrelavant, or that I'm full of hot air and I don't have a good
> question ;)

There have been discussions in the past about why the core developers
feel that moving visibility status into indexes would be a net loss
on average. I don't think there has been one for a while, but you can
try searching the hackers archive.

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: does "select count(*) from mytable" always do a seq
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Function for retreiving datatype