Re: Optimising a two column OR check - Mailing list pgsql-performance

From Andrew Gierth
Subject Re: Optimising a two column OR check
Date
Msg-id 87imotx5uq.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: Optimising a two column OR check  (MichaelDBA <MichaelDBA@sqlexec.com>)
List pgsql-performance
>>>>> "MichaelDBA" == MichaelDBA  <MichaelDBA@sqlexec.com> writes:

 MichaelDBA> Yep, you're right, Andrew, adding a couple rows made it do
 MichaelDBA> the index only scan.  I reckon I got misled by turning off
 MichaelDBA> sequential scans, thinking that actual rows were not
 MichaelDBA> important anymore.  Overly simplistic reasonings can get
 MichaelDBA> one into trouble, lol.

We do some odd stuff with the statistics estimates for completely empty
tables because (a) it's not common in practice for a table to be always
empty (i.e. the emptiness is usually transient) and (b) if you take the
emptiness of a table at face value, you end up generating insanely bad
plans for certain FK check queries that may not get replanned quickly
enough to mitigate the performance impact.

--
Andrew (irc:RhodiumToad)



pgsql-performance by date:

Previous
From: MichaelDBA
Date:
Subject: Re: Optimising a two column OR check
Next
From: Ivan Voras
Date:
Subject: Re: Optimising a two column OR check