Re: Postgresql 13 query engine regression

2021-05-10 Thread Jonathan Chen
On Tue, 11 May 2021 at 12:49, David Rowley wrote: > > On Tue, 11 May 2021 at 11:34, Jonathan Chen wrote: > > PG13 LIMIT 1 : https://explain.depesz.com/s/GFki > > PG13 no LIMIT: https://explain.depesz.com/s/U4vR > > PG12 LIMIT 1 : https://explain.depesz.com/s/JAp4 > > The difference is coming from

Re: Postgresql 13 query engine regression

2021-05-10 Thread David Rowley
On Tue, 11 May 2021 at 11:34, Jonathan Chen wrote: > PG13 LIMIT 1 : https://explain.depesz.com/s/GFki > PG13 no LIMIT: https://explain.depesz.com/s/U4vR > PG12 LIMIT 1 : https://explain.depesz.com/s/JAp4 The difference is coming from the fact that PostgreSQL 13 has incremental sort and can use th

Re: Postgresql 13 query engine regression

2021-05-10 Thread Jonathan Chen
Hmm, there's a bit of text-mangling. Let's use https://explain.depesz.com. PG13 LIMIT 1 : https://explain.depesz.com/s/GFki PG13 no LIMIT: https://explain.depesz.com/s/U4vR PG12 LIMIT 1 : https://explain.depesz.com/s/JAp4 -- Jonathan Chen

Re: Postgresql 13 query engine regression

2021-05-10 Thread Jonathan Chen
Hi, Here's a bit more detail: select version(); version - PostgreSQL 13.2 on amd64-portbld-freebsd12.2, compiled by FreeBSD

Re: Postgresql 13 query engine regression

2021-05-10 Thread Jonathan Chen
Hi, On Tue, 11 May 2021 at 10:34, Tom Lane wrote: [...] > As Adrian noted, you haven't provided enough detail to let anyone > offer more than generalities. I'll be providing the output of EXPLAIN (ANALYZE, BUFFERS) in a separate post. > However, in the spirit of generalities ... [.. helpful exp

Re: Postgresql 13 query engine regression

2021-05-10 Thread Tom Lane
Jonathan Chen writes: > I am running Postgresql 13 as a backend for Odoo, and I believe I have > discovered a regression with the query engine. As Adrian noted, you haven't provided enough detail to let anyone offer more than generalities. However, in the spirit of generalities ... ORDER BY wit

Re: Postgresql 13 query engine regression

2021-05-10 Thread Marc Millas
Hi, sorry to jump in, but looks like I have a similar pb on a 12.6 instance. on a quite simple request, with limit 1000 it takes 27ms, and with limit 10, it takes 145000 ms looking at both the explain analyze plans, there is a huge difference: with limit 1000, postgres do an optimization of the pl

Re: Postgresql 13 query engine regression

2021-05-10 Thread Adrian Klaver
On 5/10/21 2:13 PM, Jonathan Chen wrote: Hi, I am running Postgresql 13 as a backend for Odoo, and I believe I have discovered a regression with the query engine. See here: https://wiki.postgresql.org/wiki/Slow_Query_Questions for the information needed to get an answer to this sort of quest

Postgresql 13 query engine regression

2021-05-10 Thread Jonathan Chen
Hi, I am running Postgresql 13 as a backend for Odoo, and I believe I have discovered a regression with the query engine. This (simplified) query generated by the ORM takes 47.683s to complete (the result set is empty): SELECT "account_bank_statement_line".id FROM "account_bank_statement_line" LE