Search Postgresql Archives

Re: [PERFORM] Planner making wrong decisions 8.2.4. Insane cost calculations.

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

 



Henrik Zagerholm <henke@xxxxxx> writes:
> 						WHERE file_indexed IS FALSE
>                                                  AND file_copied IS TRUE
>                                                  AND file_size < (1024)
>                                                  AND LOWER 
> (file_suffix) IN(
>                                                          SELECT LOWER 
> (filetype_suffix) FROM tbl_filetype_suffix WHERE  
> filetype_suffix_index IS TRUE
>                                                  ) AND fk_archive_id  
> = 115 ORDER BY fk_tar_id

Do you really need the lower() calls there?  The planner is getting the
wrong estimate for the selectivity of the IN-clause, which is likely
because it has no statistics about lower(file_suffix) or
lower(filetype_suffix).

If you don't want to constrain the data to be already lower'd, then
setting up functional indexes on the two lower() expressions should
prompt ANALYZE to track stats for them.

			regards, tom lane

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux