Re: where in (select array)

From: Marcus Engene <mengpg2(at)engene(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: where in (select array)
Date: 2008-11-21 10:05:36
Message-ID: 492687F0.20503@engene.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
>> I imagine it's cheaper disk & dump wise to do the array thing in this and
>> some other similar usages, and therefore it would be nice to have a
>> non-ugly usage pattern.
>>
>
> Don't imagine, test. And then factor in the cost of fiddling around with
> arrays when you need to access individual values. And the cost of the
> time you spent working on all this.
>
On my dev 8.2.4 I get
using real values from a db dump with
931873 might like rows
46539 might like vector rows

Might like (row version):
10s to dump the second time, 38MB txt, 4MB gzip

Might like vector:
2s to dump the second time, 7.6MB text, 2MB gzip

Might like (row version)
explain cost, my in () version: ~200
explain cost, join on: ~670
explain cost, virtual table *): ~670

*)
select
...
from
(select ...) as a.b

Might like vector:
explain cost, my in (): 1669

If there would have been a "generate_series" function for vectors, the
choice would have been easy I think.

Best regards,
Marcus

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-11-21 10:21:48 long vacuum full, gin index and unusually long delete
Previous Message Grzegorz Jaśkiewicz 2008-11-21 09:49:37 Re: transaction isolation level in plpgsql function