Re: Discordance between the way select is called.

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Patrice Drolet <pdrolet(at)infodata(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Discordance between the way select is called.
Date: 2005-05-07 16:51:18
Message-ID: 20050507094623.W62726@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hi,
>
> I have a java app that uses hibernate to do queries.
>
> One query on a 6.5 millions records takes about 15 seconds while the
> same one (take from the sql that shows in the consol - I configured
> hibernate to show_sql) takes about 50 ms when done with pgadmin3.

We could answer better with explain output. Something like:

prepare foo(int) as select notevalue0_.id
as id, notevalue0_.value_note as value2_3_, notevalue0_.actif as
actif3_, notevalue0_.id_note as id4_3_, notevalue0_.id_field_name as
id5_3_ from note.note_value notevalue0_ where notevalue0_.id_note=$1 and
notevalue0_.actif=1;

explain analyze execute foo(<put a representative value here>);

-
As an initial guess, I'd wonder if it's guessing that for an arbitrary
id_note value that it should do a sequence scan. Are there a large number
of very common id_note values that might be throwing it off?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2005-05-07 20:54:18 Re: encoding
Previous Message Aarni Ruuhimäki 2005-05-07 16:32:35 Re: encoding