Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap Heap Scans: Rows Removed by Index Recheck & lossy blocks #689

Open
Krysztophe opened this issue Dec 12, 2024 · 0 comments
Open

Bitmap Heap Scans: Rows Removed by Index Recheck & lossy blocks #689

Krysztophe opened this issue Dec 12, 2024 · 0 comments
Assignees

Comments

@Krysztophe
Copy link

Is your feature request related to a problem? Please describe.

Example: https://explain.dalibo.com/plan/16362e9d7563ff89#plan/node/1

In this case, the Bitmap Scan cannot use enough memory. So it switches to a lossy algorithm
to store the heap blocks found by the Bitmap Index Scans.
So the Bitmap Heap Scan has to recheck every line in these blocks, which is costly.

These lines are buried in the Misc tab:

   Recheck Cond: (((demo.a >= 3) AND (demo.a <= 4)) OR ((demo.a >= 12) AND (demo.a <= 13)))
   Rows Removed by Index Recheck: 64896740
   Heap Blocks: exact=785621 lossy=743043

pev2 does not show anything else about this 😢

If there is enough memory, you get:

   Recheck Cond: (demo.a = ANY ('{3,4}'::bigint[]))
   Heap Blocks: exact=90599

and no Rows Removed by Index Recheck (in text mode; it does appear in JSON format with the value 0)

Another example : https://explain.dalibo.com/plan/7463a5chd8430493

Lossy & Recheck may appear in other cases,
for example with pg_trgm (from https://dali.bo/x2_solutions) : https://explain.dalibo.com/plan/g2d8b1eg1fa6g868

Describe the solution you'd like

This is similar to "Rows removed by Filter" on a Seq Scan, with a different solution.

Rows removed by recheck should appear on the main tab of node if its value > 0 or if « lossy » appears.

The icon, and the algorithm for the colours could be the same than for "Rows removed by Filter" .

The hint in the tooltip could be "Not enough memory, try increasing work_mem".

Describe alternatives you've considered

None

Additional context

None

@MarionGiusti MarionGiusti self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants