Re: where in (select array) - Mailing list pgsql-general

From Marcus Engene
Subject Re: where in (select array)
Date
Msg-id 492687F0.20503@engene.se
Whole thread Raw
In response to Re: where in (select array)  (Richard Huxton <dev@archonet.com>)
List 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


pgsql-general by date:

Previous
From: "Grzegorz Jaśkiewicz"
Date:
Subject: Re: transaction isolation level in plpgsql function
Next
From: Ivan Sergio Borgonovo
Date:
Subject: long vacuum full, gin index and unusually long delete