Re: [GENERAL] pgsql 7.x...
От | Mike Mascari |
---|---|
Тема | Re: [GENERAL] pgsql 7.x... |
Дата | |
Msg-id | 3866D920.DC726515@mascari.com обсуждение исходный текст |
Ответ на | pgsql 7.x... (Howie <caffeine@toodarkpark.org>) |
Ответы |
Re: [GENERAL] pgsql 7.x...
|
Список | pgsql-general |
Howie wrote: > will this function/index problem be fixed in 7.x ? > > ircbot=> explain select * from logins where dttime = NOW(); > NOTICE: QUERY PLAN: > > Seq Scan on logins (cost=33530.89 rows=71043 width=52) > EXPLAIN > ircbot=> explain select * from logins where dttime = NOW()::datetime; > NOTICE: QUERY PLAN: > > Seq Scan on logins (cost=33530.89 rows=71043 width=52) > > EXPLAIN > ircbot=> select now(); > now > ---------------------- > 1999-12-27 00:23:17-05 > (1 row) > > ircbot=> explain select * from logins where dttime='1999-12-27 > 00:23:17-05'::datetime; > NOTICE: QUERY PLAN: > > Index Scan using logins_dttime_idx on logins (cost=2.54 rows=11 width=52) > > EXPLAIN > > ( logins actually has 755,728 rows right now ) > I realize this doesn't actually answer your question, but you could always do: SELECT * from logins WHERE dttime='now'; Example: emptoris=> explain select * from sales where saledate = now(); NOTICE: QUERY PLAN: Seq Scan on sales (cost=75556.68 rows=134187 width=140) EXPLAIN emptoris=> select 'now'::datetime; ?column? ---------------------------- Mon Dec 27 03:09:58 1999 EST (1 row) emptoris=> explain select * from sales where saledate = 'now'::datetime; NOTICE: QUERY PLAN: Index Scan using k_sales4 on sales (cost=2.80 rows=17 width=140) EXPLAIN emptoris=> explain select * from sales where saledate='now'; NOTICE: QUERY PLAN: Index Scan using k_sales4 on sales (cost=2.80 rows=17 width=140) EXPLAIN emptoris=> Hope that helps, Mike Mascari
В списке pgsql-general по дате отправления: