Re: Optimizing >= and <= for numbers and dates - Mailing list pgsql-performance

From Manfred Koizar
Subject Re: Optimizing >= and <= for numbers and dates
Date
Msg-id gs8mnv4nfi6g1mqhntia6dq409dl4ov60d@4ax.com
Whole thread Raw
In response to Re: Optimizing >= and <= for numbers and dates  ("Dimitri Nagiev" <dnagiev@gmx.de>)
List 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 by date:

Previous
From: Neil Conway
Date:
Subject: Re: Optimizing >= and <= for numbers and dates
Next
From: "scott.marlowe"
Date:
Subject: Re: Optimizing >= and <= for numbers and dates