Re: Slow statement when using JDBC - Mailing list pgsql-jdbc

From vjai.krishnan
Subject Re: Slow statement when using JDBC
Date
Msg-id 1405949394928-5812199.post@n5.nabble.com
Whole thread Raw
In response to Re: Slow statement when using JDBC  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: Slow statement when using JDBC
List 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.


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Slow statement when using JDBC
Next
From: Dave Cramer
Date:
Subject: Re: Slow statement when using JDBC