DBA Hub

šŸ“‹Steps in this guide1/1

find and change statistics level of a column

-- Finding statistics level of a column ( orders.orderdate) -- statistics level range is 1-10000 ( where 100 means 1 percent,10000 means 100 percent)

postgresql configurationintermediate
by PostgreSQL
13 views
1

find and change statistics level of a column

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
-- Finding statistics level of a column ( orders.orderdate)
-- statistics level range is 1-10000 ( where 100 means 1 percent,10000 means 100 percent)
edbstore=>
SELECT attname as column_name , attstattarget as stats_level FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'orders') and attname='orderdate';
column_nameĀ  | stats_level
-------------+-------------
orderdateĀ  Ā  | 1000
(1 row)
-- To change statistics level of a column:
edbstore=>
alter table orders alter column orderdate set statistics 1000;
ALTER TABLE

Comments (0)

Please to add comments

No comments yet. Be the first to comment!