pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: vjai.krishnan <vijay.kanbu@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Slow statement when using JDBC
Date: Mon, 21 Jul 2014 06:29:54 -0700 (PDT)
Message-ID: <1405949394928-5812199.post@n5.nabble.com> (raw)
In-Reply-To: <CADK3HHJPrTev-iVwpvGm7_ZnhHaC5ou0dhjBVYN6sLY6x=mdpw@mail.gmail.com>
References: <AANLkTik_Ww_gGcNF2ntN0Emq5_KGvLN2WSDnC4BQiSTC@mail.gmail.com>
	<AANLkTik5eqiMj-GZDahLJ1HiL==xfQGxp-wZbxJwnBws@mail.gmail.com>
	<AANLkTimSzT6JkWkxJwNpWhSNLbcxaymREFHf3vAoYZTX@mail.gmail.com>
	<1375209154731-5765663.post@n5.nabble.com>
	<1405919198334-5812163.post@n5.nabble.com>
	<1405920728079-5812174.post@n5.nabble.com>
	<CA+xsaB13N+dpr4iO=Kop0qpkLf1DTvtcWfqmkYwMEyMRDrN9eQ@mail.gmail.com>
	<1405947845904-5812195.post@n5.nabble.com>
	<CADK3HHJPrTev-iVwpvGm7_ZnhHaC5ou0dhjBVYN6sLY6x=mdpw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Hi Dave,

            Thanks for your reply. I am using postgresql jdbc driver. Here
is my code that executes the query

            *Class.forName("org.postgresql.Driver");
            String pConnectionStr = "jdbc:postgresql://localhost:5432/mydb";
            conn = DriverManager.getConnection(pConnectionStr);
            String sql = "select place_id, (select count(*) from (select
unnest(ARRAY[5098092,10799979,7470935,10799979,5957205,23663129]) INTERSECT
select unnest(nameaddress_vector))s) as exactmatch from search_name where
name_vector @> ARRAY[4784827] and nameaddress_vector @>
ARRAY[17247,202321,10250,7791183,1099136,63895,202321,46909,23663130] order
by (case when importance = 0 OR importance IS NULL then
0.75-(search_rank::float/40) else importance end) DESC, exactmatch DESC
limit 2";
            stmt = conn.createStatement();
            stmt.executeQuery(sql)*;

            The above query takes 440ms in jdbc connection. But when i
execute the same query in psql client,it takes only 210ms.

Regards,
Vijay K



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Slow-statement-when-using-JDBC-tp3368379p5812199.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (17+ messages)  latest in thread

Message-ID: <1405949394928-5812199.post@n5.nabble.com>
Permalink:  ../1405949394928-5812199.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1405949394928-5812199.post@n5.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: vijay.kanbu@gmail.com
  Subject: Re: Slow statement when using JDBC
  In-Reply-To: <1405949394928-5812199.post@n5.nabble.com>
  References: <AANLkTik_Ww_gGcNF2ntN0Emq5_KGvLN2WSDnC4BQiSTC@mail.gmail.com> <AANLkTik5eqiMj-GZDahLJ1HiL==xfQGxp-wZbxJwnBws@mail.gmail.com> <AANLkTimSzT6JkWkxJwNpWhSNLbcxaymREFHf3vAoYZTX@mail.gmail.com> <1375209154731-5765663.post@n5.nabble.com> <1405919198334-5812163.post@n5.nabble.com> <1405920728079-5812174.post@n5.nabble.com> <CA+xsaB13N+dpr4iO=Kop0qpkLf1DTvtcWfqmkYwMEyMRDrN9eQ@mail.gmail.com> <1405947845904-5812195.post@n5.nabble.com> <CADK3HHJPrTev-iVwpvGm7_ZnhHaC5ou0dhjBVYN6sLY6x=mdpw@mail.gmail.com> <1405949394928-5812199.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox