Re: PG choosing nested loop for set membership?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Crowell <brian(at)fluggo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG choosing nested loop for set membership?
Date: 2014-03-26 16:43:05
Message-ID: 5190.1395852185@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brian Crowell <brian(at)fluggo(dot)com> writes:
> Which says to me coalesce has a selectivity.

Well, the point is you're just getting a default selectivity estimate
for the "acc.rule_set_id = coalesce(...anything...)" condition. The
planner is smarter about plain "x = y" join conditions: it looks up
the column stats for x and y and determines the probability of equality.

In principle I guess we could somehow merge the stats of y and z
when looking at a "coalesce(y, z)" expression, but I'm not sure
how that would work exactly.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steven Schlansker 2014-03-26 16:44:05 Re: Trimming transaction logs after extended WAL archive failures
Previous Message Steven Schlansker 2014-03-26 16:42:51 Re: Trimming transaction logs after extended WAL archive failures