From: | "vjai(dot)krishnan" <vijay(dot)kanbu(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Slow statement when using JDBC |
Date: | 2014-07-21 13:29:54 |
Message-ID: | 1405949394928-5812199.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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.
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2014-07-21 14:42:21 | Re: Slow statement when using JDBC |
Previous Message | Dave Cramer | 2014-07-21 13:21:57 | Re: Slow statement when using JDBC |