Search Postgresql Archives

Re: Slow query plan used

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

 





Am 30.05.2017 um 10:42 schrieb Wetzel, Juergen (Juergen):

> I have a question concerning the query planner. I observe that chosen query plan differs on length and content of a like
> search _expression_. We have a view combining data from two tables, both containing same number of rows (round about 30000).
> Used PostgreSQL version is 9.3.15 on Windows. DDL of tables and view see below.


the query is on DOCUMENTDATA, but plan and DDL for c3k_documentdata and other tables.

> Only 130 rows out of the 30000 have ARCHIVED = 0

in this case i would suggest a partial index:

create index <indexname> on <tablename> (archived) where archived = 0;

You can also increase the statistics for the columns subject and 
mailContent


ALTER TABLE <tablename> ALTER COLUMN <column_name> SET STATISTICS = 1000;

(as example, the default-value is 100)


Regards, Andreas
-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com

[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