Skip to content

Instantly share code, notes, and snippets.

@hidepin
Last active July 2, 2017 12:23
Show Gist options
  • Select an option

  • Save hidepin/d2b81f123c758b8384f4fdf31bece246 to your computer and use it in GitHub Desktop.

Select an option

Save hidepin/d2b81f123c758b8384f4fdf31bece246 to your computer and use it in GitHub Desktop.
pg_stat_statementsをelasticsearchで解析
psql -U postgres -c "COPY (SELECT * from pg_stat_statements) TO '/tmp/pg_stat_statements-`date +%Y%m%d%H%M`.log' WITH DELIMITER '^';"                                           
COPY 390
for i in {1..6}
do psql -U postgres -c "COPY (SELECT * from pg_stat_statements) TO '/tmp/pg_stat_statements-`date +%Y%m%d%H%M`.log' WITH DELIMITER '^';"
sleep 300
done 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment