[Outcome] Queries running forever, because of wrong rowcount estimate

2023-02-14 Thread Peter
On Mon, Feb 13, 2023 at 12:38:12PM -0500, Tom Lane wrote: ! Peter writes: ! > "rows=1" in the "Hash Anti Join" line is WRONG. It should be ! > 300. Or at least some thousands. ! ! FWIW, this behaves better in v14 and up. In older versions there's ! an ambiguity about what relpages=reltuples=

Re: [Testcase] Queries running forever, because of wrong rowcount estimate

2023-02-13 Thread Peter
On Mon, Feb 13, 2023 at 12:38:12PM -0500, Tom Lane wrote: ! Peter writes: ! > "rows=1" in the "Hash Anti Join" line is WRONG. It should be ! > 300. Or at least some thousands. ! ! FWIW, this behaves better in v14 and up. In older versions there's ! an ambiguity about what relpages=reltuples=

Re: [Testcase] Queries running forever, because of wrong rowcount estimate

2023-02-13 Thread Tom Lane
Peter writes: > "rows=1" in the "Hash Anti Join" line is WRONG. It should be > 300. Or at least some thousands. FWIW, this behaves better in v14 and up. In older versions there's an ambiguity about what relpages=reltuples=0 means; it's the state when ANALYZE has never yet examined the table

[Testcase] Queries running forever, because of wrong rowcount estimate

2023-02-12 Thread Peter
CREATE DATABASE ttc WITH OWNER = admin ENCODING = 'UTF8' LC_COLLATE = 'de_DE.UTF-8' LC_CTYPE = 'de_DE.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1 IS_TEMPLATE = False; select version(); PostgreSQL 12.13 on amd64-portbld-freebsd13.1, compiled by FreeBSD clang

Queries running forever, because of wrong rowcount estimate

2023-02-11 Thread Peter
TL;DR Version: == For a table where all rows have been deleted, under certain conditions the planner does assume that it contains the values that were previousely present, and will therefore assume that nothing needs to be added, while in fact everything needs to be added. - This