Re: [HACKERS] Solution for LIMIT cost estimation

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, chris(at)bitmead(dot)com
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Solution for LIMIT cost estimation
Date: 2000-02-14 04:57:11
Message-ID: 3.0.1.32.20000213205711.01702800@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 11:24 PM 2/13/00 -0500, Tom Lane wrote:
>Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)au> writes:
>> Tom Lane wrote:
>>> I have currently got it working (I think; not too well tested yet)
>>> using the proposal I offered before of "pay attention to the size
>>> of LIMIT, but ignore OFFSET", so that the same query plan will be
>>> derived from similar queries with different OFFSETs. Does anyone
>>> have a substantial gripe with that compromise?
>
>> Would offset be any use if you did make use of it?
>
>Yes, because the number of tuples that will *actually* get fetched
>is offset+limit.

Bravo, you're on it! I resisted responding...so far this thread
is your's, baby.

>2. Optimize using OFFSET+LIMIT as the expected number of tuples to
>fetch. Document that varying OFFSET or LIMIT will not necessarily
>generate consistent results unless you specify ORDER BY to force a
>consistent tuple order.
>
>I don't really like #1, but I can see where #2 might cause some
>unhappiness as well. Comments, opinions?

Anyone unhappy about #2 doesn't really understand the SQL model.

My suggestion's pretty simple - the database world is full of folks
who are professionals and who understand the SQL model.

We shouldn't penalize them for their professionalism.

Those who don't understand the SQL model should read the docmentation
you mention, of course, but the very fact that SQL doesn't impose
an ordering on the returned tuples is so basic to the language that
if they don't understand it, the doc should also recommend them to
"set theory for dummies" and "SQL for dummies" (unless the latter
was actually written by a dummy).

In my narrow-minded compiler-writer space, it is not MY PROBLEM if
people don't bother learning the language they use. I may or may
not choose to become one who teaches the language, but whether or not
I do has nothing to do with the implementation of the language.

It is perfectly fair to presume people understand the language. It
is their job to learn it.

If they're surprised by how the language works, then they should've
considered buying an SQL book, all of which that I've seen EMPHASIZE
the set orientation, and non-orderedness of queries.

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2000-02-14 04:59:01 Re: [HACKERS] Solution for LIMIT cost estimation
Previous Message Don Baccus 2000-02-14 04:41:35 Re: [HACKERS] Suggestion to split /data/base directory