Re: count(*) using index scan in "query often, update rarely" environment

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: count(*) using index scan in "query often, update rarely" environment
Дата
Msg-id 20051007130714.GB5175@surnet.cl
обсуждение исходный текст
Ответ на Re: count(*) using index scan in "query often, update rarely" environment  ("Cestmir Hybl" <cestmirl@freeside.sk>)
Список pgsql-performance
On Fri, Oct 07, 2005 at 01:14:20PM +0200, Cestmir Hybl wrote:
> collision: it's possible to either block updating transaction until
> index scan ends or discard index scan imediately and finish query using
> MVCC compliant scan

You can't change from one scan method to a different one on the fly.
There's no way to know which tuples have alreaady been returned.

Our index access methods are designed to be very concurrent, and it
works extremely well.  One index scan being able to block an update
would destroy that advantage.

> dead rows: this sounds like more serious counter-argument, I don't know
> much about dead records management and whether it would be
> possible/worth to make indexes matching live records when there's no
> transaction in progress on that table

It's not possible, because a finishing transaction would have to clean
up every index it has used, and also any index it hasn't used but has
been modified by another transaction which couldn't clean up by itself
but didn't do the work because the first one was looking at the index.
It's easy to see that it's possible to create an unbounded number of
transactions, each forcing the other to do some index cleanup.  This is
not acceptable.

Plus, it would be very hard to implement, and a very wide door to bugs.

--
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"Et put se mouve" (Galileo Galilei)

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

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Status of Opteron vs Xeon
Следующее
От: "Lane Van Ingen"
Дата:
Сообщение: Re: Need Some Suggestions