Re: Slow query

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query
Date: 2014-03-07 06:23:08
Message-ID: 1394173388580-5795079.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

  • Slow query at 2014-03-07 06:05:12 from Bikram Kesari Naik

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bikram Kesari Naik 2014-03-07 06:43:23 Re: Slow query
Previous Message Bikram Kesari Naik 2014-03-07 06:05:12 Slow query