pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vitalii Tymchyshyn <tivv00@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: queries with lots of UNIONed relations
Date: Fri, 14 Jan 2011 13:39:04 +0200
Message-ID: <4D3035D8.8030800@gmail.com> (raw)
In-Reply-To: <11563.1294957582@sss.pgh.pa.us>
References: <AANLkTiktjfaR9_sDU+F3UZhAQn7qrBktXE1EiOX=inzQ@mail.gmail.com>
	<19302.1294938802@sss.pgh.pa.us>
	<AANLkTikM9=JXPwYpAbfQ5KZgenWBCn5_J2=W6MRhq0U0@mail.gmail.com>
	<4879.1294949144@sss.pgh.pa.us>
	<AANLkTimx00ADoFDbOyFixLOSy4ypKjhQrHnTzanepbJD@mail.gmail.com>
	<AANLkTikYEX25b4E_AoZk=WWspv2OC7ZKct2VeZb1NCMj@mail.gmail.com>
	<11563.1294957582@sss.pgh.pa.us>

14.01.11 00:26, Tom Lane написав(ла):
> Robert Haas<robertmhaas@gmail.com>  writes:
>> On Thu, Jan 13, 2011 at 3:12 PM, Jon Nelson<jnelson+pgsql@jamponi.net>  wrote:
>>> I still think that having UNION do de-duplication of each contributory
>>> relation is a beneficial thing to consider -- especially if postgresql
>>> thinks the uniqueness is not very high.
>> This might be worth a TODO.
> I don't believe there is any case where hashing each individual relation
> is a win compared to hashing them all together.  If the optimizer were
> smart enough to be considering the situation as a whole, it would always
> do the latter.
>
>
How about cases when individual relations are already sorted? This will 
mean that they can be deduplicated fast and in streaming manner. Even 
partial sort order may help because you will need to deduplicate only 
groups with equal sorted fields, and this will take much less memory and 
be much more streaming. And if all individual deduplications are 
streaming and are sorted in one way - you can simply do a merge on top.

Best regards, Vitalii Tymchyshyn.




view thread (22+ messages)  latest in thread

Message-ID: <4D3035D8.8030800@gmail.com>
Permalink:  ../4D3035D8.8030800@gmail.com/
Also on:    postgresql.org/message-id/4D3035D8.8030800@gmail.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: tivv00@gmail.com
  Subject: Re: queries with lots of UNIONed relations
  In-Reply-To: <4D3035D8.8030800@gmail.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