I wrote:
> Another thing that might be worth fixing is the rather silly use of '%%%'
> rather than '%' for a no-op LIKE pattern.  It looks like the planner's
> LIKE-estimator gets fooled by that and doesn't realize it's a
> match-everything pattern.

Uh, scratch that advice, I fat-fingered my test.  It does seem to
estimate that '%%%' matches every row.

But that leads into another question, because some of the scan estimates
are further off than one would like:

>>              ->  Seq Scan on tblclientcomments  (cost=0.00..40651.36 
>> rows=601579 width=17) (actual time=0.014..17.342 rows=6912 loops=1017)
>>                    Filter: (((fldproductcode)::text ~~* '%%%'::text) AND 
>> (fldenable = true))

I had thought that this was explained by a bad LIKE estimate but that
seems not the case, which means that your statistics for fldenable must
be way off.   Have you ANALYZEd these tables since loading the data?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to