From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Pedro Alves <pmalves(at)think(dot)pt> |
Cc: | PostGreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Indexing timestamp columns |
Date: | 2003-03-31 18:09:33 |
Message-ID: | 24085.1049134173@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Pedro Alves <pmalves(at)think(dot)pt> writes:
> Is it possible to make a timestamp column use a index in a query like
> select foo from bar where timestamp <= smth?
The planner will do that if it thinks it's appropriate --- which in most
cases it won't. Unless your limit is pretty close to the oldest
timestamp in the table, this query will be quite unselective and so a
seqscan is actually the better way to do it.
If you want to find out whether the planner guessed right, try forcing
it to use an indexscan (via "set enable_seqscan = off"). Compare
timings.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Steven Singer | 2003-03-31 18:23:43 | Re: [Pgreplication-general] DBMIRROR and INSERT transactions lose |
Previous Message | Joe Conway | 2003-03-31 17:42:26 | Re: plpgsql question |