From: Denis de Bernardy <ddebernardy@yahoo.com>
To: PG Performance <pgsql-performance@postgresql.org>
Subject: Re: row estimate very wrong for array type
Date: Wed, 4 May 2011 07:56:52 -0700 (PDT)
Message-ID: <600933.65939.qm@web112414.mail.gq1.yahoo.com> (raw)
In-Reply-To: <186532.42226.qm@web112405.mail.gq1.yahoo.com>
References: <625605.72736.qm@web112406.mail.gq1.yahoo.com>
<10497.1304518369@sss.pgh.pa.us>
<186532.42226.qm@web112405.mail.gq1.yahoo.com>
> ----- Original Message -----
>> From: Tom Lane <tgl@sss.pgh.pa.us>
>> To: Denis de Bernardy <ddebernardy@yahoo.com>
>> Cc: "pgsql-performance@postgresql.org"
> <pgsql-performance@postgresql.org>
>> Sent: Wednesday, May 4, 2011 4:12 PM
>> Subject: Re: [PERFORM] row estimate very wrong for array type
>>
>> Array && uses areasel() which is only a stub :-(
On a separate note, in case this ever gets found via google, I managed to force the use of the correct index in the meanwhile:
# explain analyze select * from test where (0 = any(intarr1) or 1 = any(intarr1)) and (2 = any(intarr2) or 4 = any(intarr2)) order by sortcol limit 10;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..385.16 rows=10 width=217) (actual time=0.107..0.151 rows=10 loops=1)
-> Index Scan using test_sortcol_key on test (cost=0.00..14019.98 rows=364 width=217) (actual time=0.106..0.146 rows=10 loops=1)
Filter: (((0 = ANY (intarr1)) OR (1 = ANY (intarr1))) AND ((2 = ANY (intarr2)) OR (4 = ANY (intarr2))))
Total runtime: 0.214 ms
I guess I'm in for maintaining counts and rewriting queries as needed. :-(
D
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: ddebernardy@yahoo.com
Subject: Re: row estimate very wrong for array type
In-Reply-To: <600933.65939.qm@web112414.mail.gq1.yahoo.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