aboutsummaryrefslogtreecommitdiff
path: root/src/backend/catalog/system_views.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/catalog/system_views.sql')
-rw-r--r--src/backend/catalog/system_views.sql43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 30b0bd06df0..ab594eba9bc 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -117,29 +117,54 @@ CREATE VIEW pg_stats AS
stawidth AS avg_width,
stadistinct AS n_distinct,
CASE
- WHEN stakind1 IN (1, 4) THEN stavalues1
- WHEN stakind2 IN (1, 4) THEN stavalues2
- WHEN stakind3 IN (1, 4) THEN stavalues3
- WHEN stakind4 IN (1, 4) THEN stavalues4
+ WHEN stakind1 = 1 THEN stavalues1
+ WHEN stakind2 = 1 THEN stavalues2
+ WHEN stakind3 = 1 THEN stavalues3
+ WHEN stakind4 = 1 THEN stavalues4
+ WHEN stakind5 = 1 THEN stavalues5
END AS most_common_vals,
CASE
- WHEN stakind1 IN (1, 4) THEN stanumbers1
- WHEN stakind2 IN (1, 4) THEN stanumbers2
- WHEN stakind3 IN (1, 4) THEN stanumbers3
- WHEN stakind4 IN (1, 4) THEN stanumbers4
+ WHEN stakind1 = 1 THEN stanumbers1
+ WHEN stakind2 = 1 THEN stanumbers2
+ WHEN stakind3 = 1 THEN stanumbers3
+ WHEN stakind4 = 1 THEN stanumbers4
+ WHEN stakind5 = 1 THEN stanumbers5
END AS most_common_freqs,
CASE
WHEN stakind1 = 2 THEN stavalues1
WHEN stakind2 = 2 THEN stavalues2
WHEN stakind3 = 2 THEN stavalues3
WHEN stakind4 = 2 THEN stavalues4
+ WHEN stakind5 = 2 THEN stavalues5
END AS histogram_bounds,
CASE
WHEN stakind1 = 3 THEN stanumbers1[1]
WHEN stakind2 = 3 THEN stanumbers2[1]
WHEN stakind3 = 3 THEN stanumbers3[1]
WHEN stakind4 = 3 THEN stanumbers4[1]
- END AS correlation
+ WHEN stakind5 = 3 THEN stanumbers5[1]
+ END AS correlation,
+ CASE
+ WHEN stakind1 = 4 THEN stavalues1
+ WHEN stakind2 = 4 THEN stavalues2
+ WHEN stakind3 = 4 THEN stavalues3
+ WHEN stakind4 = 4 THEN stavalues4
+ WHEN stakind5 = 4 THEN stavalues5
+ END AS most_common_elems,
+ CASE
+ WHEN stakind1 = 4 THEN stanumbers1
+ WHEN stakind2 = 4 THEN stanumbers2
+ WHEN stakind3 = 4 THEN stanumbers3
+ WHEN stakind4 = 4 THEN stanumbers4
+ WHEN stakind5 = 4 THEN stanumbers5
+ END AS most_common_elem_freqs,
+ CASE
+ WHEN stakind1 = 5 THEN stanumbers1
+ WHEN stakind2 = 5 THEN stanumbers2
+ WHEN stakind3 = 5 THEN stanumbers3
+ WHEN stakind4 = 5 THEN stanumbers4
+ WHEN stakind5 = 5 THEN stanumbers5
+ END AS elem_count_histogram
FROM pg_statistic s JOIN pg_class c ON (c.oid = s.starelid)
JOIN pg_attribute a ON (c.oid = attrelid AND attnum = s.staattnum)
LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)