Re: 7.3.1 New install, large queries are slow

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Roman Fail <rfail(at)posportal(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, "sszabo(at)megazone23(dot)bigpanda(dot)com" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: 7.3.1 New install, large queries are slow
Date: 2003-01-17 14:00:19
Message-ID: Pine.BSF.4.44.0301170858080.55072-100000@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 16 Jan 2003, Roman Fail wrote:

>
> HOWEVER.....look at this:
> EXPLAIN ANALYZE select batchdetailid from batchdetail where batchdetailid = 27321::bigint;
> Index Scan using batchdetail_pkey on batchdetail (cost=0.00..4.13 rows=1 width=8) (actual time=0.03..0.03 rows=1 loops=1)
> Index Cond: (batchdetailid = 27321::bigint)
> Total runtime: 0.07 msec
>

We had this happen to us - we had a serial8 column (int8) and our query
was straight forward where id = 12345; which ran craptacularly. After
much head banging and cursing I had tried where id = '12345' and it
magically worked. I think the parser is interpreting a "number" to be an
int4 instead of int8. (instead of quotes you can also cast via
12345::int8 like you did)

Perhaps this should go on the TODO - when one side is an int8 and the
other is a literal number assume the number to be int8 instead of int4?

------------------------------------------------------------------------------
Jeff Trout <jeff(at)jefftrout(dot)com> http://www.jefftrout.com/
Ronald McDonald, with the help of cheese soup,
controls America from a secret volkswagon hidden in the past
-------------------------------------------------------------------------------

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Roman Fail 2003-01-17 14:48:28 Implicit casting and JOIN syntax constraints
Previous Message Charles H. Woloszynski 2003-01-17 13:29:25 Re: 7.3.1 New install, large queries are slow