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

From Neil Conway
Subject Re: Optimizing >= and <= for numbers and dates
Date
Msg-id 1065033355.381.97.camel@tokyo
Whole thread Raw
In response to Re: Optimizing >= and <= for numbers and dates  ("Dimitri Nagiev" <dnagiev@gmx.de>)
List pgsql-performance
On Wed, 2003-10-01 at 13:45, Dimitri Nagiev wrote:
> template1=# explain analyze select * from mytable where
> mydate>='2003-09-01';
>                                                   QUERY PLAN
>
>
> ---------------------------------------------------------------------------------------------------------------
>  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
> (3 rows)

It may well be the case that a seqscan is faster than an index scan for
this query. Try disabling sequential scans (SET enable_seqscan = false)
and re-running EXPLAIN ANALYZE: see if the total runtime is smaller or
larger.

-Neil



pgsql-performance by date:

Previous
From: Oleg Lebedev
Date:
Subject: Re: TPC-R benchmarks
Next
From: Manfred Koizar
Date:
Subject: Re: Optimizing >= and <= for numbers and dates