pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Fehrle <brianf@consistentstate.com>
To: pgsql-performance@postgresql.org
Subject: Re: Trying to eliminate union and sort
Date: Mon, 15 Jul 2013 10:12:20 -0600
Message-ID: <51E41F64.7090102@consistentstate.com> (raw)
In-Reply-To: <51E086A1.2080504@agliodbs.com>
References: <51DEF924.1040809@consistentstate.com>
	<WM!193bd65d81fa7c39e56918332a81c274363f4bb6c8de7151691ea39398f8f9117cf6aec5b0fd2887b97b4b5a921c1aa8!@asav-1.01.com>
	<51DF51DA.7010509@agliodbs.com>
	<51E082D8.4030503@consistentstate.com>
	<WM!f93ebef783f3ebd764319211a1fc2a061e1b3ac620f3e9be03f5427bcf9d16398234b8a0e70686bf34046da632bacb2e!@asav-1.01.com>
	<51E086A1.2080504@agliodbs.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 07/12/2013 04:43 PM, Josh Berkus wrote:
>> As for the counts on the tables:
>> table1      3,653,472
>> table2      2,191,314
>> table3    25,676,589
>>
>> I think it's safe to assume right now that any resulting joins are not
>> one-to-one
> Hmmm?  How is doing a subselect in the SELECT clause even working, then?
>
Oh my, this is sad. the query in all returns 9,955,729 rows, so the sub 
queries are run on each of these resulting rows, however in this entire 
result set, subquery 1 returns 16 distinct rows, subquery 2 returns 63 
different rows, but those sub queries are run over 10 million times to 
return these few distinct rows. So it's running many times, but 
returning the same small set of data over and over again.

- Brian F




-- 
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 (7+ messages)  latest in thread

Message-ID: <51E41F64.7090102@consistentstate.com>
Permalink:  ../51E41F64.7090102@consistentstate.com/
Also on:    postgresql.org/message-id/51E41F64.7090102@consistentstate.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: brianf@consistentstate.com
  Subject: Re: Trying to eliminate union and sort
  In-Reply-To: <51E41F64.7090102@consistentstate.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