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: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] TODO list updated |
Date: | 2000-01-13 03:02:40 |
Message-ID: | 200001130302.WAA28098@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:
> > We currently do not use indexes to handle ORDER BY because it is slower,
>
> Er, actually, we *do* use indexes for ORDER BY currently:
>
> regression=# explain select * from tenk1 order by unique1;
> NOTICE: QUERY PLAN:
> Index Scan using tenk1_unique1 on tenk1 (cost=760.00 rows=10000 width=148)
>
> If you start psql with PGOPTIONS="-fi" you can see that the optimizer
> believes an explicit sort would be much slower:
>
> regression=# explain select * from tenk1 order by unique1;
> NOTICE: QUERY PLAN:
> Sort (cost=3233.91 rows=10000 width=148)
> -> Seq Scan on tenk1 (cost=563.00 rows=10000 width=148)
>
> but (at least on my machine) the explicit sort is marginally faster.
> Evidently, the cost estimate for an explicit sort is *way* too high.
But it shouldn't be using the ORDER BY, except when the number of rows
processed is less than the full table, right?
>
> I have been poking at this and am currently thinking that the CPU-vs-
> disk scaling constants (_cpu_page_weight_ and cpu_index_page_weight_)
> may be drastically off for modern hardware. This is one of the
> optimizer issues that I'm hoping to resolve for 7.0.
Makes sense. CPU's have gotten much faster than disk.
--
Bruce Momjian | http://www.op.net/~candle
maillist(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 | Tom Lane | 2000-01-13 03:05:31 | Re: [HACKERS] libpq+MB/putenv(), getenv() clean up |
Previous Message | Bruce Momjian | 2000-01-13 03:01:20 | Re: [HACKERS] TODO list updated |