pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: pgsql-performance@postgresql.org
Subject: Re: Slow query
Date: Thu, 6 Mar 2014 22:23:08 -0800 (PST)
Message-ID: <1394173388580-5795079.post@n5.nabble.com> (raw)
In-Reply-To: <B2F5FFCC2D252A4DABEC0CB0C4E8100405878B14@JETWINSRVEC01.onmobile.com>
References: <B2F5FFCC2D252A4DABEC0CB0C4E8100405878B14@JETWINSRVEC01.onmobile.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (112+ messages)  latest in thread

Message-ID: <1394173388580-5795079.post@n5.nabble.com>
Permalink:  ../1394173388580-5795079.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1394173388580-5795079.post@n5.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: polobo@yahoo.com
  Subject: Re: Slow query
  In-Reply-To: <1394173388580-5795079.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox