Skip to content

[Bug] reltuples in pg_class may be wrong for index #214

@shmiwy

Description

@shmiwy

Cloudberry Database version

No response

What happened

SET gp_create_table_random_default_distribution=off;
DROP TABLE IF EXISTS foo;
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, 1 as b, 'hello world' as c FROM generate_series(1, 10) AS i;

SET optimizer=off;

VACUUM foo;
DELETE FROM foo WHERE a < 4;
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo_index';

the result for the query is

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

It seems wrong.

What you think should happen instead

The result of reltuples probably shouldn't be 0

How to reproduce

rerun the query.

Operating System

centos7

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions