Re: Partial index question

Поиск
Список
Период
Сортировка
Искать
От
Bruno Wolff III
Тема
Re: Partial index question
Дата
Msg-id
20040429095942.GB26489@wolff.to
Ответ на
Re: Partial index question (Anton Nikiforov)
Список
Дерево обсуждения
Partial index question Anton Nikiforov <anton@nikiforov.ru>
Re: Partial index question Bruno Wolff III <bruno@wolff.to>
Re: Partial index question Anton Nikiforov <anton@nikiforov.ru>
Re: Partial index question Bruno Wolff III <bruno@wolff.to>
Re: Partial index question Paul Thomas <paul@tmsl.demon.co.uk>
Re: Partial index question Anton Nikiforov <anton@nikiforov.ru>
Re: Partial index question "John Sidney-Woollett" <johnsw@wardbrook.com>
On Thu, Apr 29, 2004 at 12:53:24 +0400,
  Anton Nikiforov  wrote:
> Seq Scan on table_data  (cost=0.00..4105.40 rows=63882 width=59) 
> (actual time=0.477..425.550 rows=65536 loops=1)
>   Filter: (game = 1)
> Total runtime: 657.153 ms
> It is no matter the type of select
> SELECT max(id) FROM table_data WHERE game=1;
> SELECT * FROM table_data WHERE game=1;
> The same selects even without where clause.
> I always have the same result - sequence scan but the filter appears in 
> the explain output and the number of records being reduced.
> It that means that prtial index works? Or this is just means that i use 
> where clause in the select?

You don't want to use an aggregate. For reasons why aggregates search the
archives. What you want is to have an index on (game, id) and
use:
SELECT id from table_data where game = 1 order by game desc, id desc limit 1;
В списке pgsql-general по дате отправления
От: Bruno Wolff III
Дата:
Сообщение: Re: Partial index question
От: Paul Thomas
Дата:
Сообщение: Re: Partial index question
FAQ