diff options
author | Tomas Vondra | 2017-07-13 18:58:06 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-07-13 18:58:06 +0000 |
commit | 5c83ff3b4c072756d96e6bc7626ef7678d977bfe (patch) | |
tree | ec0a2dc1c5e073323a96d40ab0c3dad909912d2b | |
parent | f4ec9cfa19dd1af17fb20c68a646d46e1cb8949a (diff) |
Replace WARNING about skipped stats with a SELECT
ANALYZE throws a WARNING that extended statistics was not built due to
statistics target being 0 for some of the columns, but that gets thrown
on the datanode and we never forward it to the coordinator.
So explicitly check contents of pg_statistic_ext if the statistic was
built or not.
-rw-r--r-- | src/test/regress/expected/stats_ext.out | 29 | ||||
-rw-r--r-- | src/test/regress/sql/stats_ext.sql | 12 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/test/regress/expected/stats_ext.out b/src/test/regress/expected/stats_ext.out index 45aa599cc2..2194c5a342 100644 --- a/src/test/regress/expected/stats_ext.out +++ b/src/test/regress/expected/stats_ext.out @@ -79,12 +79,37 @@ ALTER TABLE ab1 ALTER a SET STATISTICS 0; INSERT INTO ab1 SELECT a, a%23 FROM generate_series(1, 1000) a; CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; ANALYZE ab1; -WARNING: statistics object "public.ab1_a_b_stats" could not be computed for relation "public.ab1" +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; + ndistinct | dependencies +-----------+-------------- + f | f +(1 row) + ALTER TABLE ab1 ALTER a SET STATISTICS -1; -- partial analyze doesn't build stats either ANALYZE ab1 (a); -WARNING: statistics object "public.ab1_a_b_stats" could not be computed for relation "public.ab1" +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; + ndistinct | dependencies +-----------+-------------- + f | f +(1 row) + ANALYZE ab1; +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; + ndistinct | dependencies +-----------+-------------- + t | t +(1 row) + DROP TABLE ab1; -- Verify supported object types for extended statistics CREATE schema tststats; diff --git a/src/test/regress/sql/stats_ext.sql b/src/test/regress/sql/stats_ext.sql index 2a02f8e0ac..9e90842d61 100644 --- a/src/test/regress/sql/stats_ext.sql +++ b/src/test/regress/sql/stats_ext.sql @@ -49,10 +49,22 @@ ALTER TABLE ab1 ALTER a SET STATISTICS 0; INSERT INTO ab1 SELECT a, a%23 FROM generate_series(1, 1000) a; CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; ANALYZE ab1; +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; ALTER TABLE ab1 ALTER a SET STATISTICS -1; -- partial analyze doesn't build stats either ANALYZE ab1 (a); +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; ANALYZE ab1; +SELECT + (stxndistinct IS NOT NULL) AS ndistinct, + (stxdependencies IS NOT NULL) AS dependencies +FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; DROP TABLE ab1; -- Verify supported object types for extended statistics |