Re: row estimate very wrong for array type - Mailing list pgsql-performance

From Denis de Bernardy
Subject Re: row estimate very wrong for array type
Date
Msg-id 600933.65939.qm@web112414.mail.gq1.yahoo.com
Whole thread Raw
In response to Re: row estimate very wrong for array type  (Denis de Bernardy <ddebernardy@yahoo.com>)
List pgsql-performance
> ----- 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=10loops=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

pgsql-performance by date:

Previous
From: Denis de Bernardy
Date:
Subject: Re: row estimate very wrong for array type
Next
From: Jim Nasby
Date:
Subject: Re: Shouldn't we have a way to avoid "risky" plans?