Re: [GENERAL] pgsql 7.x...

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Howie <caffeine(at)toodarkpark(dot)org>
Cc: PostgreSQL-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] pgsql 7.x...
Date: 1999-12-27 03:12:32
Message-ID: 3866D920.DC726515@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 1999-12-27 03:18:54 Re: [GENERAL] Future of PostgreSQL
Previous Message Thomas Reinke 1999-12-27 02:13:26 Re: Reliabilty, was [GENERAL] Future of PostgreSQL