Unix Technical Forum

BUG #1984: automatic casting for using indexes on bigint

This is a discussion on BUG #1984: automatic casting for using indexes on bigint within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 1984 Logged by: Atanas Hristov Email address: atanashristov@hotmail.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:21 AM
Atanas Hristov
 
Posts: n/a
Default BUG #1984: automatic casting for using indexes on bigint


The following bug has been logged online:

Bug reference: 1984
Logged by: Atanas Hristov
Email address: atanashristov@hotmail.com
PostgreSQL version: 8.1
Operating system: FreeBSD5
Description: automatic casting for using indexes on bigint
Details:

Maybe it is more convient to cast automaticly in sich a case? :

personalities=> create table foo (id bigint);
CREATE TABLE
personalities=> explain analyze select * from foo where id = 0;
QUERY PLAN
----------------------------------------------------------------------------
-----------------
Seq Scan on foo (cost=0.00..0.00 rows=1 width=8) (actual time=0.007..0.007
rows=0 loops=1)
Filter: (id = 0)
Total runtime: 21.140 ms
(3 rows)

personalities=> explain analyze select * from foo where cast(id as bigint) =
0;
QUERY PLAN
----------------------------------------------------------------------------
-----------------
Seq Scan on foo (cost=0.00..0.00 rows=1 width=8) (actual time=0.006..0.006
rows=0 loops=1)
Filter: (id = 0)
Total runtime: 0.077 ms
(3 rows)


best regards and thank you for the great database!!!

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:21 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #1984: automatic casting for using indexes on bigint

"Atanas Hristov" <atanashristov@hotmail.com> writes:
> Maybe it is more convient to cast automaticly in sich a case? :


These are the same query. I think you've forgotten to consider the
effects of caching on repeated execution of a query.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com