Re: row estimate very wrong for array type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> ----- Original Message -----

>>  From: Tom Lane <tgl@xxxxxxxxxxxxx>
>>  To: Denis de Bernardy <ddebernardy@xxxxxxxxx>
>>  Cc: "pgsql-performance@xxxxxxxxxxxxxx" 
> <pgsql-performance@xxxxxxxxxxxxxx>
>>  Sent: Wednesday, May 4, 2011 4:12 PM
>>  Subject: Re:  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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux