Re: Index on timestamp field, and now()
От | Denis Perchine |
---|---|
Тема | Re: Index on timestamp field, and now() |
Дата | |
Msg-id | 20020212114951.5DA361FF1A@mx.webmailstation.com обсуждение исходный текст |
Ответ на | Re: Index on timestamp field, and now() (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Index on timestamp field, and now()
|
Список | pgsql-general |
On Tuesday 12 February 2002 20:48, Tom Lane wrote: > Denis Perchine <dyp@perchine.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
В списке pgsql-general по дате отправления: