pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <neilc@samurai.com>
To: Dimitri Nagiev <dnagiev@gmx.de>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Optimizing >= and <= for numbers and dates
Date: Wed, 01 Oct 2003 14:35:55 -0400
Message-ID: <1065033355.381.97.camel@tokyo> (raw)
In-Reply-To: <3603.1065030329@www60.gmx.net>
References: <1065029881.85344.138.camel@jester>
	<3603.1065030329@www60.gmx.net>

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





view thread (7+ messages)  latest in thread

Message-ID: <1065033355.381.97.camel@tokyo>
Permalink:  ../1065033355.381.97.camel@tokyo/
Also on:    postgresql.org/message-id/1065033355.381.97.camel@tokyo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: neilc@samurai.com, dnagiev@gmx.de
  Subject: Re: Optimizing >= and <= for numbers and dates
  In-Reply-To: <1065033355.381.97.camel@tokyo>
  References: <1065029881.85344.138.camel@jester> <3603.1065030329@www60.gmx.net> <1065033355.381.97.camel@tokyo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox