Re: Duplicate WHERE condition changes performance and plan

From: "singh400(at)gmail(dot)com" <singh400(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Duplicate WHERE condition changes performance and plan
Date: 2020-04-24 16:33:25
Message-ID: CAOtbvRKvDmsN0NTrerWmbpSf-0EcQxbMVOB2mLJrOJWS4ObHAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> If you're using SSD storage, or if the DB is small compared with shared_buffers or RAM, then random_page_cost should be closer to seq_page_cost.

I don't *think* we are using SSDs but I'll need to confirm that though.

> How large are the indexes? problem_id_idx1 ?

Using the query from here:
https://wiki.postgresql.org/wiki/Index_Maintenance#Index_size.2Fusage_statistics
Output here: https://gist.github.com/indy-singh/e33eabe5cc937043c93b42a8783b3bfb

I've setup a repo here where it is possible to reproduce the weird
behaviour I'm getting:-

https://github.com/indy-singh/postgres-duplicate-where-conditon

That contains the data (amended to remove any private information) as
well as the statements need to recreate tables, indices, and
constraints,

I think after some trial and error this is something to do with the
size of the table and statistics. I've been trying to put together a
Short, Self Contained, Correct example (http://sscce.org/) and the
problem only appears when fill problem_instance.message with junk, but
I have to do it in two steps as outlined in the README in repo.

Indy

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2020-04-24 18:26:33 Re: PostgreSQL does not choose my indexes well
Previous Message Arcadio Ortega Reinoso 2020-04-23 21:01:36 Re: PostgreSQL does not choose my indexes well