Re: Index on timestamp field, and now()

From: Denis Perchine <dyp(at)perchine(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lockhart(at)fourpalms(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Index on timestamp field, and now()
Date: 2002-02-12 15:13:11
Message-ID: 20020212114951.5DA361FF1A@mx.webmailstation.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 12 February 2002 20:48, Tom Lane wrote:
> Denis Perchine <dyp(at)perchine(dot)com> writes:
> > webmailstation=> explain select * from queue where send_date > timestamp
> > 'now';
> > NOTICE: QUERY PLAN:
> >
> > Seq Scan on queue (cost=0.00..10114.06 rows=80834 width=190)
> >
> > EXPLAIN
> >
> > queue | send_date | 0 | 8 | -1 |
> >
> >
> >
> >
> >
> >
> > {"2001-12-27 21:58:24-05","2002-02-12 08:48:18.967111-05","2002-02-12
> > 15:14:51.89063-05","2002-02-13 04:06:19.979181-05","2002-02-13
> > 16:20:37.753221-05","2002-02-14 12:03:09.714262-05","2002-02-15
> > 15:15:58.04151-05","2002-02-17 11:06:16.964311-05","2002-02-20
> > 08:40:57.795043-05","2002-03-12 07:25:46-05","2003-10-28 14:58:58-05"}
> >
> > | -0.359735
>
> According to this histogram, 90% of your table has send_date in the
> future. Accordingly, seqscan is the right plan for the above query.

But I use a comparison with now() + '20 years'::interval, not with now()...
And as I have mentioned, there is no any entries more than 20 years in the
feature there.

--
Denis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-12 15:29:18 Re: index use again and again
Previous Message Holger Marzen 2002-02-12 15:04:01 Re: index use again and again