Re: Strange discrepancy in query performance...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jason L(dot) Buberel" <jason(at)buberel(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Strange discrepancy in query performance...
Date: 2007-10-02 14:13:30
Message-ID: 13949.1191334410@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jason L. Buberel" <jason(at)buberel(dot)org> writes:
> For reference, when using JasperReports .jrxml files as the basis for
> the query, I only had to do to the following to 'force' postgres to
> treat the jasper report parameter as a number and not text, thereby
> allowing the correct index to be used:

> select * from city summary where city_master_id =
> $P{city_master_id}::bigint ...

> Query times went from 300+ seconds back down to ~100ms.

Hmm ... if Postgres were just given the parameter symbol with no type
information, I believe it would have assumed it was bigint (or in
general, the same type as what it's being compared to). So your
problem suggests that Jasper is deliberately telling the backend that
that parameter is of type text. If that's coming from something you
did in your code, you probably ought to change the code. If not,
it seems like a bug/omission in Jasper.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2007-10-02 14:29:02 Re: Find min year and min value
Previous Message Douglas McNaught 2007-10-02 14:10:26 Re: Execution plan caching