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

From: Howie <caffeine(at)toodarkpark(dot)org>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] pgsql 7.x...
Date: 1999-12-27 09:45:16
Message-ID: Pine.LNX.3.96.991227092401.1580A-100000@rabies.toodarkpark.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 26 Dec 1999, Mike Mascari wrote:

> Howie wrote:
>
> > will this function/index problem be fixed in 7.x ?
> >
> > ircbot=> explain select * from logins where dttime = NOW();
> [SNIP]
> 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)
> [SNIP]

not really; just confuses me a bit more. is 'now()' not the same
datatype as 'now' ?

ircbot=> select now(),'now'::datetime,now()::datetime;
now |?column? |datetime
----------------------+----------------------------+----------------------------
1999-12-27 04:25:35-05|Mon Dec 27 04:25:35 1999 EST|Mon Dec 27 04:25:35 1999 EST
(1 row)

ircbot=> explain select * from logins where dttime = now()::datetime;
Seq Scan on logins (cost=33530.89 rows=71043 width=52)

ircbot=> explain select * from logins where dttime = 'now'::datetime;
Index Scan using logins_dttime_idx on logins (cost=2.54 rows=11 width=52)

ircbot=> select now()::datetime = 'now'::datetime;
?column?
--------
t

isnt 'NOW()' supposed to return a datetime by default? regardless,
shouldnt 'now()::datetime' be a datetime ? if so, why isnt my index on
dttime being used when its a direct comparison ?

---
Howie <caffeine(at)toodarkpark(dot)org> URL: http://www.toodarkpark.org
"I've learned that you cannot make someone love you.
All you can do is stalk them and hope they panic and give in."

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 1999-12-27 09:59:03 Re: [GENERAL] pgsql 7.x...
Previous Message franck 1999-12-27 09:33:20 Re: [GENERAL] Future of PostgreSQL