From: Tomas Vondra Date: Thu, 13 Jul 2017 18:58:06 +0000 (+0200) Subject: Replace WARNING about skipped stats with a SELECT X-Git-Tag: XL_10_R1BETA1~222 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5c83ff3b4c072756d96e6bc7626ef7678d977bfe;p=postgres-xl.git 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. --- 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