Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > performance iss...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 1911 of 1994
Post > Topic >>

performance issue

by varga@[EMAIL PROTECTED] (Steven varga) Mar 26, 2008 at 11:46 PM

hi,

having about 10^6 records in a table indexed on names
(http://www.upcdatabase.com)
and doing a query from psql I get response time in millisec order on the 
other hand when executing the same query through JDBC it hangs about 80 
seconds.
This is about 10^5 decrease in speed.

After profiling the JDBC driver simply waits for data 
PGStream.ReceiveChar() spending enough time to do a sequencial scan on all

10^6 records.

  Can anyone give a suggestion why is this lag?



PSQL:

test=# EXPLAIN ANALYZE SELECT count(*) from upc  where name like 'Aba%';
QUERY PLAN
  Aggregate  (cost=14897.01..14897.02 rows=1 width=0) (actual 
time=0.380..0.381 rows=1 loops=1)
    ->  Bitmap Heap Scan on upc (cost=57.67..14885.47 rows=4612 
width=0) (actual time=0.216..0.326 rows=13 loops=1)
          Filter: ((name)::text ~~ 'Aba%'::text)
          ->  Bitmap Index Scan on upc_name  (cost=0.00..57.67 
rows=4612 width=0) (actual time=0.155..0.155 rows=13 loops=1)
                Index Cond: (((name)::text >= 'Aba'::character varying)
AND 
((name)::text < 'Abb'::character varying))
  Total runtime: 0.670 ms
(6 rows)


JDBC:

  PreparedStatement count =
         connection.prepareStatement("SELECT count(*) FROM
 	upc WHERE name like upper(?)||'%' ");

  count.setString(1,"Aba");
  ResultSet  rs = count.executeQuery(); //<== this takes about 82 seconds 
to execute


psql (PostgreSQL) 8.1.5
postgresql-jdbc-8.3-603



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




 3 Posts in Topic:
performance issue
varga@[EMAIL PROTECTED]   2008-03-26 23:46:03 
Re: performance issue
books@[EMAIL PROTECTED]   2008-03-26 23:20:01 
Re: performance issue
mark.lewis@[EMAIL PROTECT  2008-03-28 07:28:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:43:14 CDT 2008.