Re: Optimizing >= and <= for numbers and dates

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: Optimizing >= and <= for numbers and dates
Дата
Msg-id gs8mnv4nfi6g1mqhntia6dq409dl4ov60d@4ax.com
обсуждение исходный текст
Ответ на Re: Optimizing >= and <= for numbers and dates  ("Dimitri Nagiev" <dnagiev@gmx.de>)
Список pgsql-performance
On Wed, 1 Oct 2003 19:45:29 +0200 (MEST), "Dimitri Nagiev"
<dnagiev@gmx.de> wrote:
>template1=# explain analyze select * from mytable where
>mydate>='2003-09-01';
> Seq Scan on mytable  (cost=0.00..2209.11 rows=22274 width=562) (actual time=0.06..267.30 rows=22677 loops=1)
>   Filter: (mydate >= '2003-09-01'::date)
> Total runtime: 307.71 msec

Didn't you say that there are 25000 rows in the table?  I can't
believe that for selecting 90% of all rows an index scan would be
faster.  Try

    SET enable_seqscan = 0;
    explain analyze
     select * from mytable where mydate>='2003-09-01';

If you find the index scan to be faster, there might be lots of dead
tuples in which case you should

    VACUUM FULL mytable;

Servus
 Manfred

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Optimizing >= and <= for numbers and dates
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Optimizing >= and <= for numbers and dates