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
>
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
Sort Method: external merge Disk: 1224kB
Buffers: shared hit=4217, temp
read=153 written=154
-> Seq Scan on account_move
(cost=0.00..5852.72 rows=89045 width=4) (actual time=0.007..23.127
rows=89108 loops=1)
Filter: (((company_id IS NULL)
OR (company_id = 1)) AND ((state)::text = 'posted'::text))
Rows Removed by Filter: 19940
Buffers: shared hit=4217
Planning Time: 0.495 ms
Execution Time: 75.544 ms
--
Jonathan Chen
as I'd
like to be able to 'help it', their code has too many feature-hooks
for me to easily hack their code ... Odoo has used Postgresql as it s
database since its inception back in 2008. It is just unfortunate that
it has hit this stumbling block with the latest version of the
planner.
Cheers.
--
Jonathan Chen
id" in (1)))
ORDER BY "account_move"."id"
)
)
AND ("account_bank_statement_line__move_id"."journal_id" = 29)
)
ORDER BY "account_bank_statement_line__move_id"."date" DESC,
"account_bank_statement_line"."id" DESC LIMIT 1
If I remove the "LIMIT 1" on the last line, the query completes in 0.036s.
If I remove the WHERE clause, the query completes in 0.032s.
If I run the original query on Postgresql 12.6 (on a lower spec'd
host), it completes in 0.067s.
--
Jonathan Chen