Re: Slow query - Mailing list pgsql-performance

From David Johnston
Subject Re: Slow query
Date
Msg-id 1394173388580-5795079.post@n5.nabble.com
Whole thread Raw
In response to Slow query  (Bikram Kesari Naik <bikram.naik@onmobile.com>)
Responses Re: Slow query
List pgsql-performance
Bikram Kesari Naik wrote
> Hi,
>
> I have a view which joins  multiple tables to give me a result. It takes
> more than a  minute to give me the result on psql prompt when I select all
> the data from that view.
> The single CPU which is used to run this query is utilized 100%.Even if I
> fire a count(*) it takes 10 Sec. I wanted to know if there is anything we
> can do to speedup this query below 1 sec.

In all likelihood you need to index your foreign keys, and possibly other
fields, but as you haven't provided table and index definitions it is hard
to say for sure.

Idepeing on how many rows are hidden I'm not sure an unqualified query on
this view can run in 1/60th the time even with indexes present - the
sequential scans are efficient if the proportion of the tables being
returned is high.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/Slow-query-tp5795077p5795079.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


pgsql-performance by date:

Previous
From: Bikram Kesari Naik
Date:
Subject: Slow query
Next
From: Bikram Kesari Naik
Date:
Subject: Re: Slow query