Re: Index scan vs. Seq scan on timestamps

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Per Jensen <per(at)net-es(dot)dk>
Cc: Postgres general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index scan vs. Seq scan on timestamps
Date: 2004-12-07 02:34:25
Message-ID: 20041206183201.B61668@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 6 Dec 2004, Per Jensen wrote:

> select count(*)
> from accesslog
> where time between (timeofday()::timestamp - INTERVAL '30 d') and
> timeofday()::timestamp;

Besides the type issue, timeofday() is volatile and thus is not allowed to
be turned into a constant in order to do an index scan because it's
allowed to return different values for every row of the input.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2004-12-07 02:49:25 Re: Index scan vs. Seq scan on timestamps
Previous Message Alvaro Herrera 2004-12-07 01:30:57 Re: hooks for supporting third party blobs?