Re: Estimated rows question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sam Ross <elliptic(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Estimated rows question
Date: 2012-09-02 00:47:41
Message-ID: 6832.1346546861@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

[ sorry for slow response, but I'd not gotten time to think about this... ]

Sam Ross <elliptic(at)gmail(dot)com> writes:
> I was wondering why it seems that the query planner can't "see", based
> on the histograms, that two join-columns have a very small
> intersection, and adjust its row estimation accordingly.

The reason why not is that eqjoinsel() doesn't take any such
consideration into account. It's possible that it'd be a good idea
to teach it to do so. I'm not entirely convinced though. It would
add a fair amount of expense to that function, as well as adding
some possibly shaky assumptions, and I'm not sure how often we'd
get a usefully-better estimate in practice. OTOH, there are a lot
of shaky assumptions in eqjoinsel() already, and we did decide this
was worth worrying about in mergejoin cost estimation.

Do you want to try it and submit a patch for testing?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johan Nel 2012-09-02 06:32:26 Re: "Too far out of the mainstream"
Previous Message Bruce Momjian 2012-09-01 21:14:39 Re: [GENERAL] Date conversion using day of week

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-09-02 05:06:28 Re: Yet another failure mode in pg_upgrade
Previous Message Bruce Momjian 2012-09-01 22:26:55 Re: Getting rid of cheap-startup-cost paths earlier