From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jules Bean <jules(at)jellybean(dot)co(dot)uk>, Alfred Perlstein <bright(at)wintelcom(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Performance on inserts |
Date: | 2000-10-15 23:20:35 |
Message-ID: | 200010152320.TAA17944@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > What I am more concerned about is a join that uses the most common
> > value. We do an index scan in that case.
>
> No, we do whichever plan looks cheapest. Again, it's all about
> statistics.
>
> Right now, eqjoinsel() is just a stub that returns a constant
> selectivity estimate. It might be useful to compute some more
> sophisticated value based on pg_statistic entries for the two
> columns, but right now I doubt you could tell much. Should keep
> the join case in mind when we extend the statistics...
OK, let me be more specific. Suppose the most common value in a column
is 3. For a query "col = 3", we know 3 is most common, and use the most
common statistics rather than the dispersion statistic, right?
OK, let's assume use of the most common statistic causes a sequential
scan, but use of dispersion causes an index scan.
The query "col = 3" uses sequential scan. In the query "col = tab2.col2",
the dispersion statistic is used, causing an index scan.
However, assume tab2.col2 equals 3. I assume this would cause an index
scan because the executor doesn't know about the most common value,
right? Is it worth trying to improve that?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2000-10-15 23:21:11 | RE: AW: ALTER TABLE DROP COLUMN |
Previous Message | Franck Martin | 2000-10-15 23:09:15 | RE: Performance on inserts |