Re: [PERFORM] Slow query in JDBC

2017-09-29 Thread Dave Cramer
Good catch Jeff. as for which version. We always recommend the latest version. 42.1.4 Dave Cramer da...@postgresintl.com www.postgresintl.com On 29 September 2017 at 06:44, Subramaniam C wrote: > Yes you are right the timestamp which the application was providing was in > seconds whereas the

Re: [PERFORM] Slow query in JDBC

2017-09-29 Thread Subramaniam C
Yes you are right the timestamp which the application was providing was in seconds whereas the query which was using index had a timestamp in milliseconds. So the query was taking time in application. On Fri, Sep 29, 2017 at 12:19 PM, Jeff Janes wrote: > On Thu, Sep 28, 2017 at 2:59 AM, Subraman

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Jeff Janes
On Thu, Sep 28, 2017 at 2:59 AM, Subramaniam C wrote: > First output show the output when the query is executed from sql command > line. The second output show when it is executed from the application. AS > per the output it is clear that the when the query is executed through JDBC > its not usin

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Subramaniam C
gt;>>> object_table_pkey on object_table (cost=0.42..56727.00 rows=50 >>>> width=64) >>>> >>>> Index Cond: (("timestamp" >= >>>> '0'::bigint) AND ("timestamp" <= '15059

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Dave Cramer
(cost=367431.07..373153.32 >>> rows=55526 width=16) >>> >>> -> Unique (cost=367431.07..372459.24 >>> rows=55526 width=24) >>> >>> -> Sort (cost=367431.07..369945.16 >&g

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Subramaniam C
s=55526 width=24) >> >> -> Sort (cost=367431.07..369945.16 >> rows=1005634 width=24) >> >> Sort Key: >> health_timeseries_table.mobid DESC, health_timeseries_table."timestamp" &

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Dave Cramer
-> Seq Scan on > health_timeseries_table (cost=0.00..267171.00 rows=1005634 width=24) > > > Filter: (("timestamp" >= > '1505989500000'::bigint) AND ("timestamp" <= '15

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Subramaniam C
x27;origine----- > De : pgsql-performance-ow...@postgresql.org [mailto:pgsql-performance- > ow...@postgresql.org] De la part de Julien Rouhaud > Envoyé : jeudi 28 septembre 2017 11:21 > À : Subramaniam C > Cc : pgsql-performance@postgresql.org > Objet : Re: [PERFORM] Slow query in

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Pavy Philippe
mance@postgresql.org Objet : Re: [PERFORM] Slow query in JDBC On Thu, Sep 28, 2017 at 10:58 AM, Subramaniam C wrote: > I configured cursor_tuple_fraction to 1 but still I am facing the same > issue. Can you show explain (analyze, buffers) of the query when run from psql and run from appli

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Julien Rouhaud
On Thu, Sep 28, 2017 at 10:58 AM, Subramaniam C wrote: > I configured cursor_tuple_fraction to 1 but still I am facing the same > issue. Can you show explain (analyze, buffers) of the query when run from psql and run from application (you can use auto_explain for that if needed, see https://www.p

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Subramaniam C
I configured cursor_tuple_fraction to 1 but still I am facing the same issue. Please help. On Thu, Sep 28, 2017 at 2:18 PM, Julien Rouhaud wrote: > On Thu, Sep 28, 2017 at 10:19 AM, Subramaniam C > wrote: > > Hi > > > > When I try to execute the query from sql command line then that query is >

Re: [PERFORM] Slow query in JDBC

2017-09-28 Thread Julien Rouhaud
On Thu, Sep 28, 2017 at 10:19 AM, Subramaniam C wrote: > Hi > > When I try to execute the query from sql command line then that query is > taking only around 1 sec. But when I execute the query using JDBC(Java) > using preparedStatement then the same query is taking around 10 secs. > > Can you ple

[PERFORM] Slow query in JDBC

2017-09-28 Thread Subramaniam C
Hi When I try to execute the query from sql command line then that query is taking only around 1 sec. But when I execute the query using JDBC(Java) using preparedStatement then the same query is taking around 10 secs. Can you please let us know the reason and how to fix this issue? Thanks and Re