faildb / isucon11-final-suburi-2024-01-08

0 stars 0 forks source link

PostgreSQLに移行するドンッ! #6

Closed soudai closed 10 months ago

soudai commented 10 months ago
CREATE USER isucon WITH PASSWORD 'isucon' SUPERUSER LOGIN;

-- CREATE DATABASE isucholar OWNER isucon;

CREATE DATABASE isucholar LC_COLLATE 'C' LC_CTYPE 'C' ENCODING 'UTF8' TEMPLATE template0 OWNER isucon;

CREATE SCHEMA isucholar;
soudai commented 10 months ago

俺は!!初手から!!!認証を外すぞ!!!(前回認証を外したら早くなったので

soudai commented 10 months ago

環境作った。 trustで認証している

soudai commented 10 months ago

pg_stat_statementsを有効化

CREATE EXTENSION pg_stat_statements;

ライブラリをpostgresql.confに書き込む

shared_preload_libraries = 'pg_stat_statements'
soudai commented 10 months ago

https://www.postgresql.jp/document/15/html/pgstatstatements.html

-- reset
SELECT pg_stat_statements_reset();

SELECT query, calls, total_time, rows, 100.0 * shared_blks_hit /
               nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
          FROM pg_stat_statements ORDER BY total_time DESC LIMIT 100;