Add explicit VACUUM to inet test to actually do IOS
authorTomas Vondra <[email protected]>
Sun, 30 Jul 2017 13:25:29 +0000 (15:25 +0200)
committerTomas Vondra <[email protected]>
Mon, 31 Jul 2017 01:20:45 +0000 (03:20 +0200)
commitcfb055553687c257dd1d1ed123356c892f48a804
treec25bf7fe66013d25d34f52e24c1b1c37fe7ba8fd
parentd0fdaba0d704f76ec3a4f098abec6b4551539342
Add explicit VACUUM to inet test to actually do IOS

Some of the queries in inet test are meant to exercise Index Only Scans.
Postgres-XL was not however picking those plans due to stale stats on
the coordinator (reltuples and relpages in pg_class).

On plain PostgreSQL the tests work fine, as CREATE INDEX also updates
statistics stored in the pg_class catalog. For example this

    CREATE TABLE t (a INT);

    INSERT INTO t SELECT i FROM generate_series(1,1000) s(i);

    SELECT relpages, reltuples FROM pg_class
     WHERE relname = 't';

    CREATE INDEX ON t(a);

    SELECT relpages, reltuples FROM pg_class
     WHERE relname = 't';

will show zeroes before the CREATE INDEX command, and accurate values
after it completes.

On Postgres-XL that is not the case, and we will return zeroes even after
the CREATE INDEX command. To actually update the statistics we need to
fetch information from the datanodes the way VACUUM does it.

Fixed by adding an explicit VACUUM call right after the CREATE INDEX, to
fetch the stats from the datanodes and update the coordinator catalogs.
src/test/regress/expected/inet.out
src/test/regress/sql/inet.sql