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

[Bug] unexpected reltuples number in pg_class after delete and vacuum #273

Closed
1 of 2 tasks
congxuebin opened this issue Oct 31, 2023 · 2 comments
Closed
1 of 2 tasks
Assignees
Labels
type: Bug Something isn't working

Comments

@congxuebin
Copy link
Collaborator

congxuebin commented Oct 31, 2023

Cloudberry Database version

No response

What happened

After delete 15 rows and vacuum, the following query get unexpected 88 reltuples. But the test case would expect 85. Please confirm if this is incompatible change. Thanks.

SELECT relname, reltuples FROM pg_class WHERE relname = 'foo_index';

relname | reltuples
-----------+-----------
foo_index | 88

More detailed information, please see how to reproduce section.

What you think should happen instead

No response

How to reproduce

CREATE TABLE foo (a INT, b INT, c CHAR(128)) WITH (appendonly=true) DISTRIBUTED BY (a);
CREATE INDEX foo_index ON foo(b);
INSERT INTO foo SELECT i as a, i as b, 'hello world' as c FROM generate_series(1, 50) AS i;
INSERT INTO foo SELECT i as a, i as b, 'hello world' as c FROM generate_series(51, 100) AS i;
ANALYZE foo;
DELETE FROM foo WHERE a < 16;
VACUUM foo;
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo_index';

You will get reltuples 88:

relname | reltuples
-----------+-----------
foo_index | 88
(1 row)

Operating System

centos7

Anything else

2 test cases failed due to this issue:
FAIL: UAOCompactionTestCase.test_stats
FAIL: UAOCOCompactionTestCase.test_stats

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@congxuebin congxuebin added the type: Bug Something isn't working label Oct 31, 2023
@congxuebin congxuebin changed the title [Bug] [Bug] unexpected reltuples number in pg_class after delete and vacuum Oct 31, 2023
@lss602726449
Copy link
Contributor

We shoud change the output result to 88 which is the same as GP. The reason is that we have already change the vacuum strategy for AO. We only vacuum for segno which hideRatio larger than gp_appendonly_compaction_threshold.

@congxuebin
Copy link
Collaborator Author

Thanks Shengsong for the confirmation. I would update the test case accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants