Re: [HACKERS] Query started showing wrong result after Ctrl+c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Query started showing wrong result after Ctrl+c
Дата
Msg-id 31577.1507817657@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Query started showing wrong result after Ctrl+c  (tushar <tushar.ahuja@enterprisedb.com>)
Список pgsql-hackers
tushar <tushar.ahuja@enterprisedb.com> writes:
> On 10/12/2017 03:46 PM, Marko Tiikkaja wrote:
>> The subquery:
>>     select n from tv limit 1
>> could in theory return any row due to the lack of ORDER BY. What I'm 
>> guessing happened is that you're seeing a synchronized sequential scan 
>> in follow-up queries.  Add an ORDER BY.

> Bang on . After adding order by clause - i am getting same result 
> consistently. but why i got the  different result after canceling the 
> query only?

If you let the query run to completion, the syncscan start pointer will
return to the start of the table.  Cancelling it partway through allows
the syncscan pointer to be left pointing somewhere in the middle of the
table.

If you turn off synchronize_seqscans, you should find that you always
get the physically-first table row from that subselect.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Discussion on missing optimizations
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] Discussion on missing optimizations