about 7.0 LIMIT optimization

From: "Roberto Cornacchia" <rob(dot)c(at)virgilio(dot)it>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: about 7.0 LIMIT optimization
Date: 2000-02-23 05:40:43
Message-ID: F39B9D83EA9E3D1178F20005B817149D@rob.c.virgilio.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi there,

I've just had a look at the 7.0beta and I've seen your enhancements
about LIMIT optimization.
Did you read by chance my previous message intitled
"Generalized Top Queries on PostgreSQL"?
When I wrote it I hadn't read the thread
intitled "Solution for LIMIT cost estimation" yet.

What you did looks pretty similar to part of our extension
(cost model and pruning rules). The main differences are:

- the FOR EACH generalization.

- You cannot select the top N rows according to criterion A ordering
the results with a different criterion B.

- If you ask for the best 10 rows, from a relation including
100000 rows, you have to do a traditional sort on 100000 rows and
then retain only the first 10, doing more comparisons than requested.

- You can choose a "fast-start" plan (i.e., basically,
a pipelined plan), but you cannot performe an "early-stop" of
the stream when you have a "slow-start" plan (e.g. involving sorts
or hash tables). We noticed that this kind of plan often
outperforms the first one.

So, we are looking forward to see how the new LIMIT optimization works
(we will do some tests as soon as possible). Have you noticed
relevant improvements?

Actually, we should say we can't figure out the reason for
managing the LIMIT clause in a so complicated way, not providing
a node in the plan as any other operator.
In our opinion, the choice to provide a separated process of the
LIMIT clause has two problems:
1. We find it more complicated and not so natural.
2. It is an obstacle to some optimizations and to some functionalities
(how to use it in subselects or views?)

Best regards

R. Cornacchia (cornacch(at)cs(dot)unibo(dot)it) Computer Science, University of
Bologna

A. Ghidini (ghidini(at)cs(dot)unibo(dot)it) Computer Science, University of Bologna

Dr. Paolo Ciaccia (ciaccia(at)cs(dot)unibo(dot)it) DEIS CSITE-CNR, University of
Bologna

===========================================================

VIRGILIO MAIL - Il tuo indirizzo E-mail gratis e per sempre
http://mail.virgilio.it/

VIRGILIO - La guida italiana a Internet
http://www.virgilio.it/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-02-23 05:48:09 Re: [HACKERS] Re: [PATCHES] Patch for more readable parse error messages
Previous Message Tom Lane 2000-02-23 05:12:31 Re: [HACKERS] Numeric with '-'