Re: Analyze results in more expensive query plan

2019-05-17 Thread Tom Lane
Jeremy Altavilla writes: > We have several select statements whose performance is greatly improved by > deleting some stats from pg_statistic. You might have better results by setting up some "extended stats" for the combination of bag_type columns that this query depends on. Per your descriptio

Re: using sequential scan instead of index for join with a union

2019-05-17 Thread Kent Tong
Hi, Sergei Thanks! I've just double checked and they are the same: \d notice id | bigint | | not null | nextval('notice_id_seq'::regclass) mbct_id| bigint | | | \d news id | bigint

RE: Re: Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans

2019-05-17 Thread Naik, Sameer
Deepak, I changed the datatype from citext to text and now everything works fine. The data distribution is same, plan is same, yet there is a huge performance degradation when citext is used instead of text. However the business case requires case insensitive string handling. I am looking forward

Analyze results in more expensive query plan

2019-05-17 Thread Jeremy Altavilla
Hello, We have several select statements whose performance is greatly improved by deleting some stats from pg_statistic. With the stats present the database reaches 100% cpu at 13k queries per second. Without these stats, the same machine can handle over 29k queries per second. We were able rep

Re: using sequential scan instead of index for join with a union

2019-05-17 Thread Sergei Kornilov
Hi Please check datatypes in union all part. Possible, notice.id or notice.mbct_id datatypes does not match with other tables. regards, Sergei

using sequential scan instead of index for join with a union

2019-05-17 Thread Kent Tong
Hi, I am joining the union of three tables with another table. Postgresql uses the index when only two tables are in the union. If I add one more table to the union, it switches to seq scan. Apparently it also uses the index when only one table is joined. The SQL is: select * from ( SELECT 'NEWS'