exec dbms_stats.lock_table_stats('TEST','TAB1');
exec dbms_stats.unlock_table_stats('TEST','TAB1');
show variables like 'innodb_stats%';
alter table tab6 STATS_AUTO_RECALC=0;
http://pgdbmsstats.osdn.jp/pg_dbms_stats-ja.html
rpm -ivh pg_dbms_stats94-1.3.11-1.el7.x86_64.rpm
CREATE EXTENSION pg_dbms_stats;
vim postgresql.conf
shared_preload_libraries = 'pg_dbms_stats'
pgbench -i -s 10 test
ANALYZE;
EXPLAIN ANALYZE SELECT * FROM pgbench_accounts WHERE aid >= 200000 AND aid <= 700000;
pgbench -c 5 -T 60 test
SELECT dbms_stats.lock_schema_stats('public');
select * from dbms_stats.relation_stats_locked;
SELECT dbms_stats.unlock_schema_stats('public');
--自動バキューム時に統計情報が取得されるため、
自動バキュームをオフにすることでも統計固定化は可能
vim postgresql.conf
autovacuum = off
https://docs.microsoft.com/ja-jp/sql/relational-databases/statistics/statistics?view=sql-server-2017
--グローバル
USE [master]
GO
ALTER DATABASE [test] SET AUTO_CREATE_STATISTICS OFF
GO
ALTER DATABASE [test] SET AUTO_UPDATE_STATISTICS OFF WITH NO_WAIT
GO
--テーブルレベル
UPDATE STATISTICS dbo.tab5 WITH NORECOMPUTE;
go