Re: Fetch zero result rows when executing a query?

Поиск
Список
Период
Сортировка
От Stephen R. van den Berg
Тема Re: Fetch zero result rows when executing a query?
Дата
Msg-id 20150204113656.GD25788@cuci.nl
обсуждение исходный текст
Ответ на Re: Fetch zero result rows when executing a query?  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: Fetch zero result rows when executing a query?  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
Marko Tiikkaja wrote:
>On 2/4/15 12:13 PM, Stephen R. van den Berg wrote:
>>If you know beforehand the query might generate more than one row (SELECT)
>>yet you also know that you are not interested in those, then maxrows=1
>>is best; then again, modifying the query to include a LIMIT 1 is even
>>better, in which case maxrows can be zero again.

>This seems to be a common pattern, and I think it's a *huge* mistake
>to specify maxrows=1 and/or ignore rows after the first one in the
>driver layer.  If the user says "give me the only row returned by

I guess it depends on the amount of backpressure you can excert on
the sql "programmer".
If you are writing a driver which just has to run applications
written by third parties in the most efficient way, the outline
I gave above is best.
If the driver has a way to communicate with the one writing
the SQL, then giving warnings is better.

At the driver level, you generally have to assume that communicating
with the programmer is not possible anymore unless the driver
API allows for appropriate backpressure (and if this
results in numerous warnings, they still might go largely
unnoticed on production sites).
-- 
Stephen.



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

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: Fetch zero result rows when executing a query?
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: Re: Fetch zero result rows when executing a query?