Re: [HACKERS] Solution for LIMIT cost estimation

Поиск
Список
Период
Сортировка
От Don Baccus
Тема Re: [HACKERS] Solution for LIMIT cost estimation
Дата
Msg-id 3.0.1.32.20000213205711.01702800@mail.pacifier.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Solution for LIMIT cost estimation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
At 11:24 PM 2/13/00 -0500, Tom Lane wrote:
>Chris Bitmead <chrisb@nimrod.itg.telstra.com.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@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Don Baccus
Дата:
Сообщение: Re: [HACKERS] Solution for LIMIT cost estimation
Следующее
От: Chris Bitmead
Дата:
Сообщение: Re: [HACKERS] Solution for LIMIT cost estimation