You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hari Sekhon 73f97c944e updated README.md 4 years ago
..
README.md updated README.md 4 years ago
aws_athena_cloudtrail_ddl.sql updated aws_athena_cloudtrail_ddl.sql 4 years ago
bigquery_billing_commonly_charged_units_of_measure.sql updated bigquery_billing_commonly_charged_units_of_measure.sql 4 years ago
bigquery_billing_latest_100_charges.sql updated bigquery_billing_latest_100_charges.sql 4 years ago
bigquery_billing_products_most_frequently_used.sql updated bigquery_billing_products_most_frequently_used.sql 4 years ago
bigquery_billing_products_with_highest_aggregate_cost.sql updated bigquery_billing_products_with_highest_aggregate_cost.sql 4 years ago
bigquery_billing_products_with_most_billing_records.sql updated bigquery_billing_products_with_most_billing_records.sql 4 years ago
postgres_active_query_count.sql updated postgres_active_query_count.sql 4 years ago
postgres_blocked_queries.sql added postgres_blocked_queries.sql 4 years ago
postgres_databases_by_size.sql updated postgres_databases_by_size.sql 4 years ago
postgres_databases_by_size_if_accessible.sql updated postgres_databases_by_size_if_accessible.sql 4 years ago
postgres_indexes_cache_hit_ratio.sql updated postgres_indexes_cache_hit_ratio.sql 4 years ago
postgres_last_analyze.sql updated postgres_last_analyze.sql 4 years ago
postgres_last_vacuum.sql updated postgres_last_vacuum.sql 4 years ago
postgres_last_vacuum_analyze.sql updated postgres_last_vacuum_analyze.sql 4 years ago
postgres_locks.sql added postgres_locks.sql 4 years ago
postgres_queries_slow.sql updated postgres_queries_slow.sql 4 years ago
postgres_query_cache_hit_ratio.sql updated postgres_query_cache_hit_ratio.sql 4 years ago
postgres_query_times.sql updated postgres_query_times.sql 4 years ago
postgres_query_times_pre94.sql renamed postgres_query_times_pre92.sql to postgres_query_times_pre94.sql 4 years ago
postgres_running_queries.sql updated postgres_running_queries.sql 4 years ago
postgres_running_queries_pre92.sql updated postgres_running_queries_pre92.sql 4 years ago
postgres_stale_connections.sql updated postgres_stale_connections.sql 4 years ago
postgres_tables_by_size.sql updated postgres_tables_by_size.sql 4 years ago
postgres_tables_cache_hit_ratio.sql updated postgres_tables_cache_hit_ratio.sql 4 years ago
postgres_tables_index_usage.sql updated postgres_tables_index_usage.sql 4 years ago
postgres_tables_row_estimates.sql added postgres_tables_row_estimates.sql 4 years ago

README.md

SQL Scripts

  • aws_athena_cloudtrail_ddl.sql - AWS Athena DDL to setup up integration to query CloudTrail logs from Athena
  • bigquery_billing_*.sql - Google BigQuery billing queries
  • postgres_*.sql - PostgreSQL queries for DBA investigating + performance tuning

You can quickly test these PostgreSQL scripts using postgres.sh which boots a docker container and drops in to psql shell with this directory mounted at /sql for easy sourcing eg. \i /sql/postgres_query_times.sql

See Also:

sqlcase.pl in the DevOps Perl tools repo - autocases your SQL code (I use this a lot and call it via hotkey configured in the .vimrc at the top level)

  • there are specializations of this for most of the major SQL RDBMS and distributed SQL systems using their specific language keywords