From 300fd2a80741eaf8dcf3e2900f507a5531355bd7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 27 Apr 2022 18:44:27 +0100 Subject: [PATCH 001/402] updated fork-update-pr.yaml --- .github/workflows/fork-update-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fork-update-pr.yaml b/.github/workflows/fork-update-pr.yaml index b6084b0..1ebf3ab 100644 --- a/.github/workflows/fork-update-pr.yaml +++ b/.github/workflows/fork-update-pr.yaml @@ -22,7 +22,7 @@ on: required: false default: false schedule: - - cron: '0 10 * * 2' + - cron: '0 10 * * 1' permissions: contents: write From 05e64ad0e39a62af983a092ae63d79a6ea9391e5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 28 Apr 2022 14:55:37 +0100 Subject: [PATCH 002/402] added kics.yaml --- .github/workflows/kics.yaml | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/kics.yaml diff --git a/.github/workflows/kics.yaml b/.github/workflows/kics.yaml new file mode 100644 index 0000000..513c632 --- /dev/null +++ b/.github/workflows/kics.yaml @@ -0,0 +1,54 @@ +# +# Author: Hari Sekhon +# Date: 2022-02-01 19:36:08 +0000 (Tue, 01 Feb 2022) +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +--- +name: Kics + +on: + push: + branches: + - master + - main + paths-ignore: + - '**/*.md' + pull_request: + branches: + - master + - main + paths-ignore: + - '**/*.md' + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + schedule: + - cron: '0 0 * * 1' + +permissions: + actions: read + contents: read + security-events: write + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + kics: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: Kics + uses: HariSekhon/GitHub-Actions/.github/workflows/kics.yaml@master From ad25bcb23280f7307d8897111a238cc6b688f876 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 28 Apr 2022 14:56:12 +0100 Subject: [PATCH 003/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b8e876b..9e1779b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ SQL Scripts [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) +[![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) [![Travis CI](https://img.shields.io/badge/TravisCI-ready-blue?logo=travis&label=Travis%20CI)](https://github.com/HariSekhon/SQL-scripts/blob/master/.travis.yml) [![Linux](https://img.shields.io/badge/OS-Linux-blue?logo=linux)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) From a421f97299aa3febff5a043470e28db60644ebc6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 10 May 2022 11:58:36 +0100 Subject: [PATCH 004/402] updated URLs --- .circleci/config.yml | 4 ++-- .editorconfig | 2 +- Makefile | 2 +- README.md | 12 ++++++------ analytics/bigquery_ecommerce_conversion_rate.sql | 2 +- ...bigquery_ecommerce_purchasers_on_return_visit.sql | 2 +- analytics/bigquery_ecommerce_time_on_site.sql | 2 +- analytics/bigquery_ecommerce_top_5_products.sql | 2 +- ...ssification_logistic_regression_create_model1.sql | 2 +- ...ssification_logistic_regression_create_model2.sql | 2 +- ...ification_logistic_regression_evaluate_model1.sql | 2 +- ...ification_logistic_regression_evaluate_model2.sql | 2 +- ...ation_logistic_regression_predict_with_model2.sql | 2 +- aws_athena_cloudtrail_ddl.sql | 2 +- ...ery_billing_commonly_charged_units_of_measure.sql | 2 +- bigquery_billing_latest_100_charges.sql | 2 +- bigquery_billing_products_most_frequently_used.sql | 2 +- ..._billing_products_with_highest_aggregate_cost.sql | 2 +- ...ry_billing_products_with_most_billing_records.sql | 2 +- bigquery_info_biggest_public_tables_by_row_count.sql | 2 +- mysql_databases_by_size.sql | 2 +- mysql_host_summary.sql | 2 +- mysql_indexes_unused.sql | 2 +- mysql_info.sql | 2 +- mysql_memory_by_host.sql | 2 +- mysql_memory_by_user.sql | 2 +- mysql_sessions.sql | 2 +- mysql_statement_latency_by_host.sql | 2 +- mysql_statement_latency_by_user.sql | 2 +- mysql_tables.sql | 2 +- mysql_tables_nonsystem.sql | 2 +- mysql_user.sql | 2 +- mysql_user_summary.sql | 2 +- mysql_users.sql | 2 +- mysql_users_pre56.sql | 2 +- mysql_users_pre8.sql | 2 +- mysql_views.sql | 2 +- mysql_views_system.sql | 2 +- postgres_active_query_count.sql | 2 +- postgres_backends_per_database.sql | 2 +- postgres_blocked_queries.sql | 2 +- postgres_databases_by_size.sql | 2 +- postgres_databases_by_size_if_accessible.sql | 2 +- postgres_dirs.sql | 2 +- postgres_dirs_pre10.sql | 2 +- postgres_dirs_pre11.9.sql | 2 +- postgres_idle_sessions.sql | 2 +- postgres_idle_sessions_current_db_kill.sql | 2 +- postgres_idle_sessions_current_db_kill_pre92.sql | 2 +- postgres_idle_sessions_kill.sql | 2 +- postgres_idle_sessions_pre92.sql | 2 +- postgres_index_cardinality.sql | 2 +- postgres_index_cardinality_with_schema_name.sql | 2 +- postgres_indexes_cache_hit_ratio.sql | 2 +- postgres_indexes_unused.sql | 2 +- postgres_info.sql | 2 +- postgres_info_pre10.sql | 2 +- postgres_last_analyze.sql | 2 +- postgres_last_analyze_pre94.sql | 2 +- postgres_last_vacuum.sql | 2 +- postgres_last_vacuum_analyze.sql | 2 +- postgres_last_vacuum_analyze_pre94.sql | 2 +- postgres_last_vacuum_pre91.sql | 2 +- postgres_locks.sql | 2 +- postgres_locks_blocked.sql | 2 +- postgres_locks_blocked_application.sql | 2 +- postgres_locks_query_age.sql | 2 +- postgres_locks_query_age_pre92.sql | 2 +- postgres_queries_slow.sql | 2 +- postgres_queries_slow_pre92.sql | 2 +- postgres_queries_slow_pre96.sql | 2 +- postgres_query_cache_hit_ratio.sql | 2 +- postgres_query_times.sql | 2 +- postgres_query_times_pre13.sql | 2 +- postgres_query_times_pre95.sql | 2 +- postgres_recovery.sql | 2 +- postgres_running_queries.sql | 2 +- postgres_running_queries_pre92.sql | 2 +- postgres_sequences_restart_all.sql | 2 +- postgres_sessions.sql | 2 +- postgres_sessions_pre10.sql | 2 +- postgres_sessions_state_count.sql | 2 +- postgres_settings.sql | 2 +- postgres_settings_auth.sql | 2 +- postgres_settings_autovacuum.sql | 2 +- postgres_settings_client_connection.sql | 2 +- postgres_settings_compatibility.sql | 2 +- postgres_settings_connections.sql | 2 +- postgres_settings_developer.sql | 2 +- postgres_settings_error_handling.sql | 2 +- postgres_settings_files.sql | 2 +- postgres_settings_locking.sql | 2 +- postgres_settings_logging.sql | 2 +- postgres_settings_memory.sql | 2 +- postgres_settings_misc.sql | 2 +- postgres_settings_preset.sql | 2 +- postgres_settings_query_planning.sql | 2 +- postgres_settings_replication.sql | 2 +- postgres_settings_resources.sql | 2 +- postgres_settings_ssl.sql | 2 +- postgres_settings_statistics.sql | 2 +- postgres_settings_wal.sql | 2 +- postgres_tables_by_size.sql | 2 +- postgres_tables_cache_hit_ratio.sql | 2 +- postgres_tables_index_usage.sql | 2 +- postgres_tables_row_estimates.sql | 2 +- setup/bootstrap.sh | 6 +++--- setup/ci_bootstrap.sh | 4 ++-- test.sh | 2 +- 109 files changed, 118 insertions(+), 118 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc2492b..4ec21d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,13 +5,13 @@ # # vim:ts=2:sts=2:sw=2:et # -# https://github.com/harisekhon/sql-scripts +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # -# https://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # https://circleci.com/docs/2.0/configuration-reference diff --git a/.editorconfig b/.editorconfig index 8327005..097285b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,7 @@ # Author: Hari Sekhon # Date: 2015-10-31 19:04:34 +0000 (Sat, 31 Oct 2015) # -# https://github.com/harisekhon/sql-scripts +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # diff --git a/Makefile b/Makefile index d7ba8e7..5782290 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback # -# https://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # On Ubuntu this fails to pushd otherwise diff --git a/README.md b/README.md index 9e1779b..b786b79 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ SQL Scripts [git.io/SQL](https://git.io/SQL) -Useful SQL scripts, split from [DevOps Bash tools](https://github.com/harisekhon/devops-bash-tools), for which this is now a submodule. +Useful SQL scripts, split from [DevOps Bash tools](https://github.com/HariSekhon/DevOps-Bash-tools), for which this is now a submodule. Hari Sekhon Cloud & Big Data Contractor, United Kingdom -[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=linkedin)](https://www.linkedin.com/in/harisekhon/) +[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=linkedin)](https://www.linkedin.com/in/HariSekhon/) ###### (you're welcome to connect with me on LinkedIn) ### Inventory @@ -66,7 +66,7 @@ Cloud & Big Data Contractor, United Kingdom #### DevOps SQL tooling -You can quickly test the PostgreSQL / MySQL scripts using `postgres.sh` / `mysqld.sh` / `mariadb.sh` in the [DevOps Bash tools](https://github.com/harisekhon/devops-bash-tools) repo, which boots a docker container and drops straight in to a `mysql` / `psql` shell with this directory mounted at `/sql` and used as `$PWD` for fast easy sourcing eg. +You can quickly test the PostgreSQL / MySQL scripts using `postgres.sh` / `mysqld.sh` / `mariadb.sh` in the [DevOps Bash tools](https://github.com/HariSekhon/DevOps-Bash-tools) repo, which boots a docker container and drops straight in to a `mysql` / `psql` shell with this directory mounted at `/sql` and used as `$PWD` for fast easy sourcing eg. postgres: ``` @@ -107,15 +107,15 @@ source /sql/mysql_sessions.sql ### See Also -- [DevOps Bash Tools](https://github.com/harisekhon/devops-bash-tools) - 700+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies +- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 700+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies - [Templates](https://github.com/HariSekhon/Templates) - dozens of Code & Config templates - AWS, GCP, Docker, Jenkins, Terraform, Vagrant, Puppet, Python, Bash, Go, Perl, Java, Scala, Groovy, Maven, SBT, Gradle, Make, GitHub Actions Workflows, CircleCI, Jenkinsfile, Makefile, Dockerfile, docker-compose.yml, M4 etc. - [Kubernetes configs](https://github.com/HariSekhon/Kubernetes-configs) - Kubernetes YAML configs - Best Practices, Tips & Tricks are baked right into the templates for future deployments -- [DevOps Python Tools](https://github.com/harisekhon/devops-python-tools) - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython +- [DevOps Python Tools](https://github.com/HariSekhon/DevOps-Python-tools) - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython -- [The Advanced Nagios Plugins Collection](https://github.com/harisekhon/nagios-plugins) - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux) +- [The Advanced Nagios Plugins Collection](https://github.com/HariSekhon/Nagios-Plugins) - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux) - [DevOps Perl Tools](https://github.com/harisekhon/perl-tools) - 25+ DevOps CLI tools for Hadoop, HDFS, Hive, Solr/SolrCloud CLI, Log Anonymizer, Nginx stats & HTTP(S) URL watchers for load balanced web farms, Dockerfiles & SQL ReCaser (MySQL, PostgreSQL, AWS Redshift, Snowflake, Apache Drill, Hive, Impala, Cassandra CQL, Microsoft SQL Server, Oracle, Couchbase N1QL, Dockerfiles, Pig Latin, Neo4j, InfluxDB), Ambari FreeIPA Kerberos, Datameer, Linux... diff --git a/analytics/bigquery_ecommerce_conversion_rate.sql b/analytics/bigquery_ecommerce_conversion_rate.sql index 030c677..c383ba4 100644 --- a/analytics/bigquery_ecommerce_conversion_rate.sql +++ b/analytics/bigquery_ecommerce_conversion_rate.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- WITH visitors AS( diff --git a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql index 7cfe2dd..283f983 100644 --- a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql +++ b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- visitors who bought on a return visit (could have bought on first as well) diff --git a/analytics/bigquery_ecommerce_time_on_site.sql b/analytics/bigquery_ecommerce_time_on_site.sql index 67c24f9..432f469 100644 --- a/analytics/bigquery_ecommerce_time_on_site.sql +++ b/analytics/bigquery_ecommerce_time_on_site.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- looking at bounces and time on site are not good features for model training and prediction since of the top 10 customers by time on site only 1 purchased! diff --git a/analytics/bigquery_ecommerce_top_5_products.sql b/analytics/bigquery_ecommerce_top_5_products.sql index 0aa174d..60a20e8 100644 --- a/analytics/bigquery_ecommerce_top_5_products.sql +++ b/analytics/bigquery_ecommerce_top_5_products.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- SELECT diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql index e233e0b..43a30d9 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- ran for 2 minutes to build the trained model diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql index e5cefb5..c3831d7 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- ran in 2 mins diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql index 2d34c8a..3255dfc 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- evaluate model1 diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql index d044266..97d43ad 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- evaluate model2 with more features diff --git a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql index f948030..e31f645 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- use the improved model 2 to predict which users will buy on return visit diff --git a/aws_athena_cloudtrail_ddl.sql b/aws_athena_cloudtrail_ddl.sql index 9e0058a..e76a2ca 100644 --- a/aws_athena_cloudtrail_ddl.sql +++ b/aws_athena_cloudtrail_ddl.sql @@ -11,7 +11,7 @@ -- If you're using my code you're welcome to connect with me on LinkedIn -- and optionally send me feedback to help improve or steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- replace and on last line diff --git a/bigquery_billing_commonly_charged_units_of_measure.sql b/bigquery_billing_commonly_charged_units_of_measure.sql index bc2ff2b..9dc91ae 100644 --- a/bigquery_billing_commonly_charged_units_of_measure.sql +++ b/bigquery_billing_commonly_charged_units_of_measure.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- BigQuery Billing Query diff --git a/bigquery_billing_latest_100_charges.sql b/bigquery_billing_latest_100_charges.sql index c9fe119..6bcbed5 100644 --- a/bigquery_billing_latest_100_charges.sql +++ b/bigquery_billing_latest_100_charges.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- BigQuery Billing Query diff --git a/bigquery_billing_products_most_frequently_used.sql b/bigquery_billing_products_most_frequently_used.sql index 56428a3..ce616a1 100644 --- a/bigquery_billing_products_most_frequently_used.sql +++ b/bigquery_billing_products_most_frequently_used.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- BigQuery Billing Query diff --git a/bigquery_billing_products_with_highest_aggregate_cost.sql b/bigquery_billing_products_with_highest_aggregate_cost.sql index efa718c..b8acc28 100644 --- a/bigquery_billing_products_with_highest_aggregate_cost.sql +++ b/bigquery_billing_products_with_highest_aggregate_cost.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- BigQuery Billing Query diff --git a/bigquery_billing_products_with_most_billing_records.sql b/bigquery_billing_products_with_most_billing_records.sql index dcf0f9a..b07f9e1 100644 --- a/bigquery_billing_products_with_most_billing_records.sql +++ b/bigquery_billing_products_with_most_billing_records.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- BigQuery Billing Query diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index cb517a4..deddbca 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -24,7 +24,7 @@ -- -- in the DevOps Bash tools repo: -- --- https://github.com/HariSekhon/devops-bash-tools +-- https://github.com/HariSekhon/DevOps-Bash-tools -- Unfortunately we can't do this trick for the bigquery-public-data project because of this error: -- diff --git a/mysql_databases_by_size.sql b/mysql_databases_by_size.sql index 94d298c..a34af8f 100644 --- a/mysql_databases_by_size.sql +++ b/mysql_databases_by_size.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL databases by size descending diff --git a/mysql_host_summary.sql b/mysql_host_summary.sql index 9f76a04..7c17f21 100644 --- a/mysql_host_summary.sql +++ b/mysql_host_summary.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL show activity per host diff --git a/mysql_indexes_unused.sql b/mysql_indexes_unused.sql index 1228070..67aa67b 100644 --- a/mysql_indexes_unused.sql +++ b/mysql_indexes_unused.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL unused indexes diff --git a/mysql_info.sql b/mysql_info.sql index 6d23485..d111eca 100644 --- a/mysql_info.sql +++ b/mysql_info.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful MySQL funcs & info diff --git a/mysql_memory_by_host.sql b/mysql_memory_by_host.sql index ccd0029..c1d7548 100644 --- a/mysql_memory_by_host.sql +++ b/mysql_memory_by_host.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL memory used per host diff --git a/mysql_memory_by_user.sql b/mysql_memory_by_user.sql index 0338f39..dbd1a2d 100644 --- a/mysql_memory_by_user.sql +++ b/mysql_memory_by_user.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL memory used per user diff --git a/mysql_sessions.sql b/mysql_sessions.sql index 92bc42a..4a97464 100644 --- a/mysql_sessions.sql +++ b/mysql_sessions.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL sessions diff --git a/mysql_statement_latency_by_host.sql b/mysql_statement_latency_by_host.sql index db94dbf..1548bff 100644 --- a/mysql_statement_latency_by_host.sql +++ b/mysql_statement_latency_by_host.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL statement latency stats per host diff --git a/mysql_statement_latency_by_user.sql b/mysql_statement_latency_by_user.sql index 1315b6b..f271d12 100644 --- a/mysql_statement_latency_by_user.sql +++ b/mysql_statement_latency_by_user.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL statement latency stats per user diff --git a/mysql_tables.sql b/mysql_tables.sql index ef340af..b53628b 100644 --- a/mysql_tables.sql +++ b/mysql_tables.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL tables across schemas (useful for finding tables) diff --git a/mysql_tables_nonsystem.sql b/mysql_tables_nonsystem.sql index a4b74d0..4a4bec8 100644 --- a/mysql_tables_nonsystem.sql +++ b/mysql_tables_nonsystem.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL tables across schemas, excluding system tables such as information_schema, performance_schema, mysql and sys diff --git a/mysql_user.sql b/mysql_user.sql index d9bef20..ce4e40c 100644 --- a/mysql_user.sql +++ b/mysql_user.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL Requested vs Actual User diff --git a/mysql_user_summary.sql b/mysql_user_summary.sql index ec39724..38aa7ff 100644 --- a/mysql_user_summary.sql +++ b/mysql_user_summary.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL show activity per user diff --git a/mysql_users.sql b/mysql_users.sql index 78a227a..ebd7ea3 100644 --- a/mysql_users.sql +++ b/mysql_users.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List MySQL users ordered by host, user similar to auth resolution diff --git a/mysql_users_pre56.sql b/mysql_users_pre56.sql index 5652aad..417be47 100644 --- a/mysql_users_pre56.sql +++ b/mysql_users_pre56.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List MySQL users ordered by host, user similar to auth resolution diff --git a/mysql_users_pre8.sql b/mysql_users_pre8.sql index b9bcb5c..efdfd5b 100644 --- a/mysql_users_pre8.sql +++ b/mysql_users_pre8.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List MySQL users ordered by host, user similar to auth resolution diff --git a/mysql_views.sql b/mysql_views.sql index 85c3021..744d63c 100644 --- a/mysql_views.sql +++ b/mysql_views.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL views across schemas (useful for finding views) diff --git a/mysql_views_system.sql b/mysql_views_system.sql index cd2414b..a346d12 100644 --- a/mysql_views_system.sql +++ b/mysql_views_system.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- MySQL system views diff --git a/postgres_active_query_count.sql b/postgres_active_query_count.sql index 8ef918e..d736371 100644 --- a/postgres_active_query_count.sql +++ b/postgres_active_query_count.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL number of active queries diff --git a/postgres_backends_per_database.sql b/postgres_backends_per_database.sql index 8d36767..cc19d12 100644 --- a/postgres_backends_per_database.sql +++ b/postgres_backends_per_database.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL number of backends connected to each database diff --git a/postgres_blocked_queries.sql b/postgres_blocked_queries.sql index b2062c3..786069f 100644 --- a/postgres_blocked_queries.sql +++ b/postgres_blocked_queries.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Lists PostgreSQL queries blocked along with the pids of those holding the locks blocking them diff --git a/postgres_databases_by_size.sql b/postgres_databases_by_size.sql index 885acc4..8b22cc0 100644 --- a/postgres_databases_by_size.sql +++ b/postgres_databases_by_size.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL databases by size descending diff --git a/postgres_databases_by_size_if_accessible.sql b/postgres_databases_by_size_if_accessible.sql index 671668e..89b9197 100644 --- a/postgres_databases_by_size_if_accessible.sql +++ b/postgres_databases_by_size_if_accessible.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL databases by size descending (only ones you can access) diff --git a/postgres_dirs.sql b/postgres_dirs.sql index 71049ae..60d1798 100644 --- a/postgres_dirs.sql +++ b/postgres_dirs.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful PostgreSQL dir info diff --git a/postgres_dirs_pre10.sql b/postgres_dirs_pre10.sql index b756cb8..d18b9c7 100644 --- a/postgres_dirs_pre10.sql +++ b/postgres_dirs_pre10.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful PostgreSQL dir info diff --git a/postgres_dirs_pre11.9.sql b/postgres_dirs_pre11.9.sql index fba9e84..8a41f99 100644 --- a/postgres_dirs_pre11.9.sql +++ b/postgres_dirs_pre11.9.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful PostgreSQL dir info diff --git a/postgres_idle_sessions.sql b/postgres_idle_sessions.sql index 0e5e92b..eff9b93 100644 --- a/postgres_idle_sessions.sql +++ b/postgres_idle_sessions.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List PostgreSQL stale connections that have been idle > 10 mins diff --git a/postgres_idle_sessions_current_db_kill.sql b/postgres_idle_sessions_current_db_kill.sql index 790be5e..f6e0069 100644 --- a/postgres_idle_sessions_current_db_kill.sql +++ b/postgres_idle_sessions_current_db_kill.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Kills idle PostgreSQL sessions for the currently select DB that haven't been used in > 15 minutes diff --git a/postgres_idle_sessions_current_db_kill_pre92.sql b/postgres_idle_sessions_current_db_kill_pre92.sql index df90fa6..31f280c 100644 --- a/postgres_idle_sessions_current_db_kill_pre92.sql +++ b/postgres_idle_sessions_current_db_kill_pre92.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Kills idle PostgreSQL sessions for the currently select DB that haven't been used in > 15 minutes diff --git a/postgres_idle_sessions_kill.sql b/postgres_idle_sessions_kill.sql index 3e25427..1a21019 100644 --- a/postgres_idle_sessions_kill.sql +++ b/postgres_idle_sessions_kill.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Kills idle PostgreSQL sessions that haven't been used in > 15 minutes diff --git a/postgres_idle_sessions_pre92.sql b/postgres_idle_sessions_pre92.sql index f2b6293..67090a1 100644 --- a/postgres_idle_sessions_pre92.sql +++ b/postgres_idle_sessions_pre92.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List PostgreSQL stale connections that have been idle > 10 mins diff --git a/postgres_index_cardinality.sql b/postgres_index_cardinality.sql index 488adb7..a0c0e0b 100644 --- a/postgres_index_cardinality.sql +++ b/postgres_index_cardinality.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL index cardinality diff --git a/postgres_index_cardinality_with_schema_name.sql b/postgres_index_cardinality_with_schema_name.sql index 8446cb8..f466355 100644 --- a/postgres_index_cardinality_with_schema_name.sql +++ b/postgres_index_cardinality_with_schema_name.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL index cardinality with schema name diff --git a/postgres_indexes_cache_hit_ratio.sql b/postgres_indexes_cache_hit_ratio.sql index 40e26bd..acd32e7 100644 --- a/postgres_indexes_cache_hit_ratio.sql +++ b/postgres_indexes_cache_hit_ratio.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Indexes Cache-hit Ratio diff --git a/postgres_indexes_unused.sql b/postgres_indexes_unused.sql index 0360b17..276fc50 100644 --- a/postgres_indexes_unused.sql +++ b/postgres_indexes_unused.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL unused indexes diff --git a/postgres_info.sql b/postgres_info.sql index 1e220f2..1e35d85 100644 --- a/postgres_info.sql +++ b/postgres_info.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful PostgreSQL functions & info diff --git a/postgres_info_pre10.sql b/postgres_info_pre10.sql index c279588..f775b49 100644 --- a/postgres_info_pre10.sql +++ b/postgres_info_pre10.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Useful PostgreSQL functions & info diff --git a/postgres_last_analyze.sql b/postgres_last_analyze.sql index 87ee51f..ae7dfda 100644 --- a/postgres_last_analyze.sql +++ b/postgres_last_analyze.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Analyze info for tables with rows modified since last analyze diff --git a/postgres_last_analyze_pre94.sql b/postgres_last_analyze_pre94.sql index cbf7adb..9a96c08 100644 --- a/postgres_last_analyze_pre94.sql +++ b/postgres_last_analyze_pre94.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Analyze info for tables with rows modified since last analyze diff --git a/postgres_last_vacuum.sql b/postgres_last_vacuum.sql index a165f7e..741c9b6 100644 --- a/postgres_last_vacuum.sql +++ b/postgres_last_vacuum.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Vacuum info for tables with deleted rows diff --git a/postgres_last_vacuum_analyze.sql b/postgres_last_vacuum_analyze.sql index ededac1..5ecb01d 100644 --- a/postgres_last_vacuum_analyze.sql +++ b/postgres_last_vacuum_analyze.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Vacuum and Analyze info diff --git a/postgres_last_vacuum_analyze_pre94.sql b/postgres_last_vacuum_analyze_pre94.sql index b4e4e55..c850ddd 100644 --- a/postgres_last_vacuum_analyze_pre94.sql +++ b/postgres_last_vacuum_analyze_pre94.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Vacuum and Analyze info diff --git a/postgres_last_vacuum_pre91.sql b/postgres_last_vacuum_pre91.sql index 880cd2d..8f266e5 100644 --- a/postgres_last_vacuum_pre91.sql +++ b/postgres_last_vacuum_pre91.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Vacuum info for tables with deleted rows diff --git a/postgres_locks.sql b/postgres_locks.sql index 858d553..198a244 100644 --- a/postgres_locks.sql +++ b/postgres_locks.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List PostgreSQL Locks diff --git a/postgres_locks_blocked.sql b/postgres_locks_blocked.sql index e3ff168..372155a 100644 --- a/postgres_locks_blocked.sql +++ b/postgres_locks_blocked.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List PostgreSQL locks blocked diff --git a/postgres_locks_blocked_application.sql b/postgres_locks_blocked_application.sql index 0b962c7..8477f56 100644 --- a/postgres_locks_blocked_application.sql +++ b/postgres_locks_blocked_application.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- List PostgreSQL locks blocked with application name diff --git a/postgres_locks_query_age.sql b/postgres_locks_query_age.sql index 260aae7..31d21de 100644 --- a/postgres_locks_query_age.sql +++ b/postgres_locks_query_age.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL locks with query and age diff --git a/postgres_locks_query_age_pre92.sql b/postgres_locks_query_age_pre92.sql index bba58f4..fb8b8ff 100644 --- a/postgres_locks_query_age_pre92.sql +++ b/postgres_locks_query_age_pre92.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL locks with query and age for PostgreSQL <= 9.1 diff --git a/postgres_queries_slow.sql b/postgres_queries_slow.sql index ffd756c..2987d59 100644 --- a/postgres_queries_slow.sql +++ b/postgres_queries_slow.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL queries currently executing that have taken over 30 secs diff --git a/postgres_queries_slow_pre92.sql b/postgres_queries_slow_pre92.sql index 8df9ba8..2c03379 100644 --- a/postgres_queries_slow_pre92.sql +++ b/postgres_queries_slow_pre92.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL queries currently executing that have taken over 30 secs diff --git a/postgres_queries_slow_pre96.sql b/postgres_queries_slow_pre96.sql index f52091b..c464524 100644 --- a/postgres_queries_slow_pre96.sql +++ b/postgres_queries_slow_pre96.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL queries currently executing that have taken over 30 secs diff --git a/postgres_query_cache_hit_ratio.sql b/postgres_query_cache_hit_ratio.sql index 5877db0..f611a21 100644 --- a/postgres_query_cache_hit_ratio.sql +++ b/postgres_query_cache_hit_ratio.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL queries cache-hit ratio from pg_stat_statements diff --git a/postgres_query_times.sql b/postgres_query_times.sql index 5d397f7..4c71557 100644 --- a/postgres_query_times.sql +++ b/postgres_query_times.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL query times from pg_stat_statements diff --git a/postgres_query_times_pre13.sql b/postgres_query_times_pre13.sql index 070a11f..49ccd17 100644 --- a/postgres_query_times_pre13.sql +++ b/postgres_query_times_pre13.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL query times from pg_stat_statements diff --git a/postgres_query_times_pre95.sql b/postgres_query_times_pre95.sql index 08eecae..30ee640 100644 --- a/postgres_query_times_pre95.sql +++ b/postgres_query_times_pre95.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL query times from pg_stat_statements for PostgreSQL <= 9.4 diff --git a/postgres_recovery.sql b/postgres_recovery.sql index 90b611c..ff7886b 100644 --- a/postgres_recovery.sql +++ b/postgres_recovery.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL recovery info diff --git a/postgres_running_queries.sql b/postgres_running_queries.sql index 3ff6ee3..2acbf64 100644 --- a/postgres_running_queries.sql +++ b/postgres_running_queries.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Running queries for PostgreSQL >= 9.2 diff --git a/postgres_running_queries_pre92.sql b/postgres_running_queries_pre92.sql index 337993f..ae8f95f 100644 --- a/postgres_running_queries_pre92.sql +++ b/postgres_running_queries_pre92.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Running queries for PostgreSQL <= 9.1 diff --git a/postgres_sequences_restart_all.sql b/postgres_sequences_restart_all.sql index 3d90ad6..5027377 100644 --- a/postgres_sequences_restart_all.sql +++ b/postgres_sequences_restart_all.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Restarts all PostgreSQL sequences diff --git a/postgres_sessions.sql b/postgres_sessions.sql index fde4dea..8b4e229 100644 --- a/postgres_sessions.sql +++ b/postgres_sessions.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL count of sessions in each state diff --git a/postgres_sessions_pre10.sql b/postgres_sessions_pre10.sql index 826abe5..017176d 100644 --- a/postgres_sessions_pre10.sql +++ b/postgres_sessions_pre10.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL count of sessions in each state diff --git a/postgres_sessions_state_count.sql b/postgres_sessions_state_count.sql index eeb12a3..d8ca5a3 100644 --- a/postgres_sessions_state_count.sql +++ b/postgres_sessions_state_count.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL count of sessions in each state diff --git a/postgres_settings.sql b/postgres_settings.sql index a5332a6..8665d76 100644 --- a/postgres_settings.sql +++ b/postgres_settings.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL running settings and those set in postgres.conf diff --git a/postgres_settings_auth.sql b/postgres_settings_auth.sql index 7687070..1a20f37 100644 --- a/postgres_settings_auth.sql +++ b/postgres_settings_auth.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL authentication settings diff --git a/postgres_settings_autovacuum.sql b/postgres_settings_autovacuum.sql index 6bf7b7d..0faca9c 100644 --- a/postgres_settings_autovacuum.sql +++ b/postgres_settings_autovacuum.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL auto vacuum settings diff --git a/postgres_settings_client_connection.sql b/postgres_settings_client_connection.sql index 0a70e17..343b94c 100644 --- a/postgres_settings_client_connection.sql +++ b/postgres_settings_client_connection.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL client connection default settings diff --git a/postgres_settings_compatibility.sql b/postgres_settings_compatibility.sql index a017abe..765526d 100644 --- a/postgres_settings_compatibility.sql +++ b/postgres_settings_compatibility.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL version and platform compatibility settings diff --git a/postgres_settings_connections.sql b/postgres_settings_connections.sql index 64423df..98a14fe 100644 --- a/postgres_settings_connections.sql +++ b/postgres_settings_connections.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL connection settings diff --git a/postgres_settings_developer.sql b/postgres_settings_developer.sql index 62d8b10..04ab7f2 100644 --- a/postgres_settings_developer.sql +++ b/postgres_settings_developer.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL developer options settings diff --git a/postgres_settings_error_handling.sql b/postgres_settings_error_handling.sql index 241bc94..7b974b0 100644 --- a/postgres_settings_error_handling.sql +++ b/postgres_settings_error_handling.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL error handling settings diff --git a/postgres_settings_files.sql b/postgres_settings_files.sql index 5438d4e..3664caf 100644 --- a/postgres_settings_files.sql +++ b/postgres_settings_files.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL file location settings diff --git a/postgres_settings_locking.sql b/postgres_settings_locking.sql index 465c4b4..6d7f987 100644 --- a/postgres_settings_locking.sql +++ b/postgres_settings_locking.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL lock settings diff --git a/postgres_settings_logging.sql b/postgres_settings_logging.sql index 2bfc0e1..ecae0a0 100644 --- a/postgres_settings_logging.sql +++ b/postgres_settings_logging.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL logging settings diff --git a/postgres_settings_memory.sql b/postgres_settings_memory.sql index 28bef4a..424bf5b 100644 --- a/postgres_settings_memory.sql +++ b/postgres_settings_memory.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL memory resource settings diff --git a/postgres_settings_misc.sql b/postgres_settings_misc.sql index e1a7f9c..991a9e3 100644 --- a/postgres_settings_misc.sql +++ b/postgres_settings_misc.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL misc settings diff --git a/postgres_settings_preset.sql b/postgres_settings_preset.sql index ff38309..b131a4f 100644 --- a/postgres_settings_preset.sql +++ b/postgres_settings_preset.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL preset options settings diff --git a/postgres_settings_query_planning.sql b/postgres_settings_query_planning.sql index 6c5d760..9e47533 100644 --- a/postgres_settings_query_planning.sql +++ b/postgres_settings_query_planning.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL Query Tuning & Query Statistics Collection settings diff --git a/postgres_settings_replication.sql b/postgres_settings_replication.sql index 0df5cf6..8b22e16 100644 --- a/postgres_settings_replication.sql +++ b/postgres_settings_replication.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL Replication settings diff --git a/postgres_settings_resources.sql b/postgres_settings_resources.sql index 9030e80..29c0419 100644 --- a/postgres_settings_resources.sql +++ b/postgres_settings_resources.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL resource settings diff --git a/postgres_settings_ssl.sql b/postgres_settings_ssl.sql index 90f0839..86d5c5a 100644 --- a/postgres_settings_ssl.sql +++ b/postgres_settings_ssl.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL SSL settings diff --git a/postgres_settings_statistics.sql b/postgres_settings_statistics.sql index 15db27f..2947d0d 100644 --- a/postgres_settings_statistics.sql +++ b/postgres_settings_statistics.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL statistics collection settings diff --git a/postgres_settings_wal.sql b/postgres_settings_wal.sql index 20db7a9..f7c2c79 100644 --- a/postgres_settings_wal.sql +++ b/postgres_settings_wal.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- Show PostgreSQL WAL settings diff --git a/postgres_tables_by_size.sql b/postgres_tables_by_size.sql index 9823507..fdfab5b 100644 --- a/postgres_tables_by_size.sql +++ b/postgres_tables_by_size.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL tables by size, excluding catalog and information schema diff --git a/postgres_tables_cache_hit_ratio.sql b/postgres_tables_cache_hit_ratio.sql index 28f2569..aabbe47 100644 --- a/postgres_tables_cache_hit_ratio.sql +++ b/postgres_tables_cache_hit_ratio.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL Tables Cache-hit Ratio diff --git a/postgres_tables_index_usage.sql b/postgres_tables_index_usage.sql index 463c816..9af44ce 100644 --- a/postgres_tables_index_usage.sql +++ b/postgres_tables_index_usage.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL % of times indexes are used on tables by table size descending (might want to tweak to list by % descending) diff --git a/postgres_tables_row_estimates.sql b/postgres_tables_row_estimates.sql index 570e56d..0865445 100644 --- a/postgres_tables_row_estimates.sql +++ b/postgres_tables_row_estimates.sql @@ -10,7 +10,7 @@ -- -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -- --- https://www.linkedin.com/in/harisekhon +-- https://www.linkedin.com/in/HariSekhon -- -- PostgreSQL table row count estimates in one place diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 1d9ac37..c57a990 100755 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -4,13 +4,13 @@ # Author: Hari Sekhon # Date: 2019-10-16 10:33:03 +0100 (Wed, 16 Oct 2019) # -# https://github.com/harisekhon/sql-scripts +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # -# https://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # Alpine / Wget: @@ -25,7 +25,7 @@ set -eu [ -n "${DEBUG:-}" ] && set -x srcdir="$(dirname "$0")" -repo="https://github.com/HariSekhon/sql-scripts" +repo="https://github.com/HariSekhon/SQL-scripts" directory="sql-scripts" diff --git a/setup/ci_bootstrap.sh b/setup/ci_bootstrap.sh index cb7e1ec..61133f2 100755 --- a/setup/ci_bootstrap.sh +++ b/setup/ci_bootstrap.sh @@ -4,13 +4,13 @@ # Author: Hari Sekhon # Date: 2020-06-02 17:43:35 +0100 (Tue, 02 Jun 2020) # -# https://github.com/harisekhon/sql-scripts +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # -# https://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # Designed to bootstrap all CI systems with retries to make sure the networking, package lists and package repos works before proceeding diff --git a/test.sh b/test.sh index 4154277..ce79de1 100755 --- a/test.sh +++ b/test.sh @@ -10,7 +10,7 @@ # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # -# https://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # set -euo pipefail From a1b6071c367a48096028e8ddd2a974fa92751ae4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 10 May 2022 12:22:51 +0100 Subject: [PATCH 005/402] updated URLs --- .travis.yml | 2 +- analytics/bigquery_ecommerce_conversion_rate.sql | 2 +- analytics/bigquery_ecommerce_purchasers_on_return_visit.sql | 2 +- analytics/bigquery_ecommerce_time_on_site.sql | 2 +- analytics/bigquery_ecommerce_top_5_products.sql | 2 +- ...uery_ml_classification_logistic_regression_create_model1.sql | 2 +- ...uery_ml_classification_logistic_regression_create_model2.sql | 2 +- ...ry_ml_classification_logistic_regression_evaluate_model1.sql | 2 +- ...ry_ml_classification_logistic_regression_evaluate_model2.sql | 2 +- ...l_classification_logistic_regression_predict_with_model2.sql | 2 +- aws_athena_cloudtrail_ddl.sql | 2 +- bigquery_billing_commonly_charged_units_of_measure.sql | 2 +- bigquery_billing_latest_100_charges.sql | 2 +- bigquery_billing_products_most_frequently_used.sql | 2 +- bigquery_billing_products_with_highest_aggregate_cost.sql | 2 +- bigquery_billing_products_with_most_billing_records.sql | 2 +- bigquery_info_biggest_public_tables_by_row_count.sql | 2 +- bigquery_info_columns.sql | 2 +- bigquery_info_columns_partitioned_clustered.sql | 2 +- bigquery_info_datasets.sql | 2 +- bigquery_info_tables.sql | 2 +- mysql_databases_by_size.sql | 2 +- mysql_host_summary.sql | 2 +- mysql_indexes_unused.sql | 2 +- mysql_info.sql | 2 +- mysql_memory_by_host.sql | 2 +- mysql_memory_by_user.sql | 2 +- mysql_sessions.sql | 2 +- mysql_statement_latency_by_host.sql | 2 +- mysql_statement_latency_by_user.sql | 2 +- mysql_tables.sql | 2 +- mysql_tables_nonsystem.sql | 2 +- mysql_user.sql | 2 +- mysql_user_summary.sql | 2 +- mysql_users.sql | 2 +- mysql_users_pre56.sql | 2 +- mysql_users_pre8.sql | 2 +- mysql_views.sql | 2 +- mysql_views_system.sql | 2 +- postgres_active_query_count.sql | 2 +- postgres_backends_per_database.sql | 2 +- postgres_blocked_queries.sql | 2 +- postgres_columns_null.sql | 2 +- postgres_columns_useless.sql | 2 +- postgres_databases_by_size.sql | 2 +- postgres_databases_by_size_if_accessible.sql | 2 +- postgres_dirs.sql | 2 +- postgres_dirs_pre10.sql | 2 +- postgres_dirs_pre11.9.sql | 2 +- postgres_grant_select_all_tables.sql | 2 +- postgres_idle_sessions.sql | 2 +- postgres_idle_sessions_current_db_kill.sql | 2 +- postgres_idle_sessions_current_db_kill_pre92.sql | 2 +- postgres_idle_sessions_kill.sql | 2 +- postgres_idle_sessions_pre92.sql | 2 +- postgres_index_cardinality.sql | 2 +- postgres_index_cardinality_with_schema_name.sql | 2 +- postgres_indexes_cache_hit_ratio.sql | 2 +- postgres_indexes_unused.sql | 2 +- postgres_info.sql | 2 +- postgres_info_pre10.sql | 2 +- postgres_last_analyze.sql | 2 +- postgres_last_analyze_pre94.sql | 2 +- postgres_last_vacuum.sql | 2 +- postgres_last_vacuum_analyze.sql | 2 +- postgres_last_vacuum_analyze_pre94.sql | 2 +- postgres_last_vacuum_pre91.sql | 2 +- postgres_locks.sql | 2 +- postgres_locks_blocked.sql | 2 +- postgres_locks_blocked_application.sql | 2 +- postgres_locks_query_age.sql | 2 +- postgres_locks_query_age_pre92.sql | 2 +- postgres_queries_slow.sql | 2 +- postgres_queries_slow_pre92.sql | 2 +- postgres_queries_slow_pre96.sql | 2 +- postgres_query_cache_hit_ratio.sql | 2 +- postgres_query_times.sql | 2 +- postgres_query_times_pre13.sql | 2 +- postgres_query_times_pre95.sql | 2 +- postgres_recovery.sql | 2 +- postgres_running_queries.sql | 2 +- postgres_running_queries_pre92.sql | 2 +- postgres_sequences_restart_all.sql | 2 +- postgres_sessions.sql | 2 +- postgres_sessions_pre10.sql | 2 +- postgres_sessions_state_count.sql | 2 +- postgres_settings.sql | 2 +- postgres_settings_auth.sql | 2 +- postgres_settings_autovacuum.sql | 2 +- postgres_settings_client_connection.sql | 2 +- postgres_settings_compatibility.sql | 2 +- postgres_settings_connections.sql | 2 +- postgres_settings_developer.sql | 2 +- postgres_settings_error_handling.sql | 2 +- postgres_settings_files.sql | 2 +- postgres_settings_locking.sql | 2 +- postgres_settings_logging.sql | 2 +- postgres_settings_memory.sql | 2 +- postgres_settings_misc.sql | 2 +- postgres_settings_preset.sql | 2 +- postgres_settings_query_planning.sql | 2 +- postgres_settings_replication.sql | 2 +- postgres_settings_resources.sql | 2 +- postgres_settings_ssl.sql | 2 +- postgres_settings_statistics.sql | 2 +- postgres_settings_wal.sql | 2 +- postgres_tables_by_size.sql | 2 +- postgres_tables_cache_hit_ratio.sql | 2 +- postgres_tables_index_usage.sql | 2 +- postgres_tables_row_estimates.sql | 2 +- test.sh | 2 +- 111 files changed, 111 insertions(+), 111 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2f3891..f773634 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ # Author: Hari Sekhon # Date: 2020-08-12 12:31:25 +0100 (Wed, 12 Aug 2020) # -# https://github.com/harisekhon/sql +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # diff --git a/analytics/bigquery_ecommerce_conversion_rate.sql b/analytics/bigquery_ecommerce_conversion_rate.sql index c383ba4..264f210 100644 --- a/analytics/bigquery_ecommerce_conversion_rate.sql +++ b/analytics/bigquery_ecommerce_conversion_rate.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql index 283f983..5b36e88 100644 --- a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql +++ b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ecommerce_time_on_site.sql b/analytics/bigquery_ecommerce_time_on_site.sql index 432f469..e8aea5f 100644 --- a/analytics/bigquery_ecommerce_time_on_site.sql +++ b/analytics/bigquery_ecommerce_time_on_site.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ecommerce_top_5_products.sql b/analytics/bigquery_ecommerce_top_5_products.sql index 60a20e8..f5ce189 100644 --- a/analytics/bigquery_ecommerce_top_5_products.sql +++ b/analytics/bigquery_ecommerce_top_5_products.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql index 43a30d9..1f2a7af 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql index c3831d7..50efdc0 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql index 3255dfc..4f00d24 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql index 97d43ad..f8dd5e8 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql index e31f645..f8ce4e5 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/aws_athena_cloudtrail_ddl.sql b/aws_athena_cloudtrail_ddl.sql index e76a2ca..11f9c86 100644 --- a/aws_athena_cloudtrail_ddl.sql +++ b/aws_athena_cloudtrail_ddl.sql @@ -4,7 +4,7 @@ -- -- vim:ts=4:sts=4:sw=4:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_billing_commonly_charged_units_of_measure.sql b/bigquery_billing_commonly_charged_units_of_measure.sql index 9dc91ae..5c1e18a 100644 --- a/bigquery_billing_commonly_charged_units_of_measure.sql +++ b/bigquery_billing_commonly_charged_units_of_measure.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_billing_latest_100_charges.sql b/bigquery_billing_latest_100_charges.sql index 6bcbed5..6e7a671 100644 --- a/bigquery_billing_latest_100_charges.sql +++ b/bigquery_billing_latest_100_charges.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_billing_products_most_frequently_used.sql b/bigquery_billing_products_most_frequently_used.sql index ce616a1..cf7d422 100644 --- a/bigquery_billing_products_most_frequently_used.sql +++ b/bigquery_billing_products_most_frequently_used.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_billing_products_with_highest_aggregate_cost.sql b/bigquery_billing_products_with_highest_aggregate_cost.sql index b8acc28..72f0347 100644 --- a/bigquery_billing_products_with_highest_aggregate_cost.sql +++ b/bigquery_billing_products_with_highest_aggregate_cost.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_billing_products_with_most_billing_records.sql b/bigquery_billing_products_with_most_billing_records.sql index b07f9e1..4ba9cd1 100644 --- a/bigquery_billing_products_with_most_billing_records.sql +++ b/bigquery_billing_products_with_most_billing_records.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index deddbca..4a642b3 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_info_columns.sql b/bigquery_info_columns.sql index 753064e..93337f9 100644 --- a/bigquery_info_columns.sql +++ b/bigquery_info_columns.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_info_columns_partitioned_clustered.sql b/bigquery_info_columns_partitioned_clustered.sql index fd1921b..3ac5e31 100644 --- a/bigquery_info_columns_partitioned_clustered.sql +++ b/bigquery_info_columns_partitioned_clustered.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_info_datasets.sql b/bigquery_info_datasets.sql index e5709ad..fe14179 100644 --- a/bigquery_info_datasets.sql +++ b/bigquery_info_datasets.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/bigquery_info_tables.sql b/bigquery_info_tables.sql index c2ca58c..9cc55cb 100644 --- a/bigquery_info_tables.sql +++ b/bigquery_info_tables.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_databases_by_size.sql b/mysql_databases_by_size.sql index a34af8f..75bc325 100644 --- a/mysql_databases_by_size.sql +++ b/mysql_databases_by_size.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_host_summary.sql b/mysql_host_summary.sql index 7c17f21..aa43dcc 100644 --- a/mysql_host_summary.sql +++ b/mysql_host_summary.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_indexes_unused.sql b/mysql_indexes_unused.sql index 67aa67b..08e59b3 100644 --- a/mysql_indexes_unused.sql +++ b/mysql_indexes_unused.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_info.sql b/mysql_info.sql index d111eca..45adb75 100644 --- a/mysql_info.sql +++ b/mysql_info.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_memory_by_host.sql b/mysql_memory_by_host.sql index c1d7548..30f8ed0 100644 --- a/mysql_memory_by_host.sql +++ b/mysql_memory_by_host.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_memory_by_user.sql b/mysql_memory_by_user.sql index dbd1a2d..37f96ee 100644 --- a/mysql_memory_by_user.sql +++ b/mysql_memory_by_user.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_sessions.sql b/mysql_sessions.sql index 4a97464..ad92e90 100644 --- a/mysql_sessions.sql +++ b/mysql_sessions.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_statement_latency_by_host.sql b/mysql_statement_latency_by_host.sql index 1548bff..8e28b42 100644 --- a/mysql_statement_latency_by_host.sql +++ b/mysql_statement_latency_by_host.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_statement_latency_by_user.sql b/mysql_statement_latency_by_user.sql index f271d12..ad69960 100644 --- a/mysql_statement_latency_by_user.sql +++ b/mysql_statement_latency_by_user.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_tables.sql b/mysql_tables.sql index b53628b..a4735e4 100644 --- a/mysql_tables.sql +++ b/mysql_tables.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_tables_nonsystem.sql b/mysql_tables_nonsystem.sql index 4a4bec8..b483a29 100644 --- a/mysql_tables_nonsystem.sql +++ b/mysql_tables_nonsystem.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_user.sql b/mysql_user.sql index ce4e40c..213f495 100644 --- a/mysql_user.sql +++ b/mysql_user.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_user_summary.sql b/mysql_user_summary.sql index 38aa7ff..eb1a94f 100644 --- a/mysql_user_summary.sql +++ b/mysql_user_summary.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_users.sql b/mysql_users.sql index ebd7ea3..eab3c81 100644 --- a/mysql_users.sql +++ b/mysql_users.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_users_pre56.sql b/mysql_users_pre56.sql index 417be47..c99e98c 100644 --- a/mysql_users_pre56.sql +++ b/mysql_users_pre56.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_users_pre8.sql b/mysql_users_pre8.sql index efdfd5b..f304e5b 100644 --- a/mysql_users_pre8.sql +++ b/mysql_users_pre8.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_views.sql b/mysql_views.sql index 744d63c..7b3ae45 100644 --- a/mysql_views.sql +++ b/mysql_views.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/mysql_views_system.sql b/mysql_views_system.sql index a346d12..f63fa62 100644 --- a/mysql_views_system.sql +++ b/mysql_views_system.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_active_query_count.sql b/postgres_active_query_count.sql index d736371..8dd041a 100644 --- a/postgres_active_query_count.sql +++ b/postgres_active_query_count.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_backends_per_database.sql b/postgres_backends_per_database.sql index cc19d12..426d25e 100644 --- a/postgres_backends_per_database.sql +++ b/postgres_backends_per_database.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_blocked_queries.sql b/postgres_blocked_queries.sql index 786069f..a7d8042 100644 --- a/postgres_blocked_queries.sql +++ b/postgres_blocked_queries.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_columns_null.sql b/postgres_columns_null.sql index 2c55746..32b7001 100644 --- a/postgres_columns_null.sql +++ b/postgres_columns_null.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_columns_useless.sql b/postgres_columns_useless.sql index 0a5d298..c997507 100644 --- a/postgres_columns_useless.sql +++ b/postgres_columns_useless.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_databases_by_size.sql b/postgres_databases_by_size.sql index 8b22cc0..a49b92e 100644 --- a/postgres_databases_by_size.sql +++ b/postgres_databases_by_size.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_databases_by_size_if_accessible.sql b/postgres_databases_by_size_if_accessible.sql index 89b9197..c4b7589 100644 --- a/postgres_databases_by_size_if_accessible.sql +++ b/postgres_databases_by_size_if_accessible.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_dirs.sql b/postgres_dirs.sql index 60d1798..6142945 100644 --- a/postgres_dirs.sql +++ b/postgres_dirs.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_dirs_pre10.sql b/postgres_dirs_pre10.sql index d18b9c7..3a92ec5 100644 --- a/postgres_dirs_pre10.sql +++ b/postgres_dirs_pre10.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_dirs_pre11.9.sql b/postgres_dirs_pre11.9.sql index 8a41f99..b910b63 100644 --- a/postgres_dirs_pre11.9.sql +++ b/postgres_dirs_pre11.9.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_grant_select_all_tables.sql b/postgres_grant_select_all_tables.sql index 6532373..96353cf 100644 --- a/postgres_grant_select_all_tables.sql +++ b/postgres_grant_select_all_tables.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/HariSekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_idle_sessions.sql b/postgres_idle_sessions.sql index eff9b93..4a023ab 100644 --- a/postgres_idle_sessions.sql +++ b/postgres_idle_sessions.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_idle_sessions_current_db_kill.sql b/postgres_idle_sessions_current_db_kill.sql index f6e0069..52dd8fd 100644 --- a/postgres_idle_sessions_current_db_kill.sql +++ b/postgres_idle_sessions_current_db_kill.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_idle_sessions_current_db_kill_pre92.sql b/postgres_idle_sessions_current_db_kill_pre92.sql index 31f280c..b5ed2ac 100644 --- a/postgres_idle_sessions_current_db_kill_pre92.sql +++ b/postgres_idle_sessions_current_db_kill_pre92.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_idle_sessions_kill.sql b/postgres_idle_sessions_kill.sql index 1a21019..b2e0b18 100644 --- a/postgres_idle_sessions_kill.sql +++ b/postgres_idle_sessions_kill.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_idle_sessions_pre92.sql b/postgres_idle_sessions_pre92.sql index 67090a1..9c47f4f 100644 --- a/postgres_idle_sessions_pre92.sql +++ b/postgres_idle_sessions_pre92.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_index_cardinality.sql b/postgres_index_cardinality.sql index a0c0e0b..1b8ae51 100644 --- a/postgres_index_cardinality.sql +++ b/postgres_index_cardinality.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_index_cardinality_with_schema_name.sql b/postgres_index_cardinality_with_schema_name.sql index f466355..eb00745 100644 --- a/postgres_index_cardinality_with_schema_name.sql +++ b/postgres_index_cardinality_with_schema_name.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_indexes_cache_hit_ratio.sql b/postgres_indexes_cache_hit_ratio.sql index acd32e7..0c8ae36 100644 --- a/postgres_indexes_cache_hit_ratio.sql +++ b/postgres_indexes_cache_hit_ratio.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_indexes_unused.sql b/postgres_indexes_unused.sql index 276fc50..58f8844 100644 --- a/postgres_indexes_unused.sql +++ b/postgres_indexes_unused.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_info.sql b/postgres_info.sql index 1e35d85..f08cb81 100644 --- a/postgres_info.sql +++ b/postgres_info.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_info_pre10.sql b/postgres_info_pre10.sql index f775b49..e63dbca 100644 --- a/postgres_info_pre10.sql +++ b/postgres_info_pre10.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_analyze.sql b/postgres_last_analyze.sql index ae7dfda..6c8b39d 100644 --- a/postgres_last_analyze.sql +++ b/postgres_last_analyze.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_analyze_pre94.sql b/postgres_last_analyze_pre94.sql index 9a96c08..c97fa72 100644 --- a/postgres_last_analyze_pre94.sql +++ b/postgres_last_analyze_pre94.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_vacuum.sql b/postgres_last_vacuum.sql index 741c9b6..47ee2cc 100644 --- a/postgres_last_vacuum.sql +++ b/postgres_last_vacuum.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_vacuum_analyze.sql b/postgres_last_vacuum_analyze.sql index 5ecb01d..59a989d 100644 --- a/postgres_last_vacuum_analyze.sql +++ b/postgres_last_vacuum_analyze.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_vacuum_analyze_pre94.sql b/postgres_last_vacuum_analyze_pre94.sql index c850ddd..3245b5a 100644 --- a/postgres_last_vacuum_analyze_pre94.sql +++ b/postgres_last_vacuum_analyze_pre94.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_last_vacuum_pre91.sql b/postgres_last_vacuum_pre91.sql index 8f266e5..06d3714 100644 --- a/postgres_last_vacuum_pre91.sql +++ b/postgres_last_vacuum_pre91.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_locks.sql b/postgres_locks.sql index 198a244..7c29724 100644 --- a/postgres_locks.sql +++ b/postgres_locks.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_locks_blocked.sql b/postgres_locks_blocked.sql index 372155a..a8e26f1 100644 --- a/postgres_locks_blocked.sql +++ b/postgres_locks_blocked.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_locks_blocked_application.sql b/postgres_locks_blocked_application.sql index 8477f56..740e035 100644 --- a/postgres_locks_blocked_application.sql +++ b/postgres_locks_blocked_application.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_locks_query_age.sql b/postgres_locks_query_age.sql index 31d21de..769dfd3 100644 --- a/postgres_locks_query_age.sql +++ b/postgres_locks_query_age.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_locks_query_age_pre92.sql b/postgres_locks_query_age_pre92.sql index fb8b8ff..d94618c 100644 --- a/postgres_locks_query_age_pre92.sql +++ b/postgres_locks_query_age_pre92.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_queries_slow.sql b/postgres_queries_slow.sql index 2987d59..ecafbce 100644 --- a/postgres_queries_slow.sql +++ b/postgres_queries_slow.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_queries_slow_pre92.sql b/postgres_queries_slow_pre92.sql index 2c03379..7c336fa 100644 --- a/postgres_queries_slow_pre92.sql +++ b/postgres_queries_slow_pre92.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_queries_slow_pre96.sql b/postgres_queries_slow_pre96.sql index c464524..446d178 100644 --- a/postgres_queries_slow_pre96.sql +++ b/postgres_queries_slow_pre96.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_query_cache_hit_ratio.sql b/postgres_query_cache_hit_ratio.sql index f611a21..5f89ce1 100644 --- a/postgres_query_cache_hit_ratio.sql +++ b/postgres_query_cache_hit_ratio.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_query_times.sql b/postgres_query_times.sql index 4c71557..6afbab3 100644 --- a/postgres_query_times.sql +++ b/postgres_query_times.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_query_times_pre13.sql b/postgres_query_times_pre13.sql index 49ccd17..e4337e3 100644 --- a/postgres_query_times_pre13.sql +++ b/postgres_query_times_pre13.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_query_times_pre95.sql b/postgres_query_times_pre95.sql index 30ee640..4368322 100644 --- a/postgres_query_times_pre95.sql +++ b/postgres_query_times_pre95.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_recovery.sql b/postgres_recovery.sql index ff7886b..dd95b83 100644 --- a/postgres_recovery.sql +++ b/postgres_recovery.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_running_queries.sql b/postgres_running_queries.sql index 2acbf64..47e2003 100644 --- a/postgres_running_queries.sql +++ b/postgres_running_queries.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_running_queries_pre92.sql b/postgres_running_queries_pre92.sql index ae8f95f..faa6a16 100644 --- a/postgres_running_queries_pre92.sql +++ b/postgres_running_queries_pre92.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_sequences_restart_all.sql b/postgres_sequences_restart_all.sql index 5027377..b31c230 100644 --- a/postgres_sequences_restart_all.sql +++ b/postgres_sequences_restart_all.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_sessions.sql b/postgres_sessions.sql index 8b4e229..090719d 100644 --- a/postgres_sessions.sql +++ b/postgres_sessions.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_sessions_pre10.sql b/postgres_sessions_pre10.sql index 017176d..535b947 100644 --- a/postgres_sessions_pre10.sql +++ b/postgres_sessions_pre10.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_sessions_state_count.sql b/postgres_sessions_state_count.sql index d8ca5a3..426320d 100644 --- a/postgres_sessions_state_count.sql +++ b/postgres_sessions_state_count.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings.sql b/postgres_settings.sql index 8665d76..aac16c9 100644 --- a/postgres_settings.sql +++ b/postgres_settings.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_auth.sql b/postgres_settings_auth.sql index 1a20f37..df66655 100644 --- a/postgres_settings_auth.sql +++ b/postgres_settings_auth.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_autovacuum.sql b/postgres_settings_autovacuum.sql index 0faca9c..82b80cb 100644 --- a/postgres_settings_autovacuum.sql +++ b/postgres_settings_autovacuum.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_client_connection.sql b/postgres_settings_client_connection.sql index 343b94c..c62731b 100644 --- a/postgres_settings_client_connection.sql +++ b/postgres_settings_client_connection.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_compatibility.sql b/postgres_settings_compatibility.sql index 765526d..c98655d 100644 --- a/postgres_settings_compatibility.sql +++ b/postgres_settings_compatibility.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_connections.sql b/postgres_settings_connections.sql index 98a14fe..e7e29ca 100644 --- a/postgres_settings_connections.sql +++ b/postgres_settings_connections.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_developer.sql b/postgres_settings_developer.sql index 04ab7f2..d0cb0a4 100644 --- a/postgres_settings_developer.sql +++ b/postgres_settings_developer.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_error_handling.sql b/postgres_settings_error_handling.sql index 7b974b0..9a85df1 100644 --- a/postgres_settings_error_handling.sql +++ b/postgres_settings_error_handling.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_files.sql b/postgres_settings_files.sql index 3664caf..5c1e9fb 100644 --- a/postgres_settings_files.sql +++ b/postgres_settings_files.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_locking.sql b/postgres_settings_locking.sql index 6d7f987..5df1da6 100644 --- a/postgres_settings_locking.sql +++ b/postgres_settings_locking.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_logging.sql b/postgres_settings_logging.sql index ecae0a0..3aaf385 100644 --- a/postgres_settings_logging.sql +++ b/postgres_settings_logging.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_memory.sql b/postgres_settings_memory.sql index 424bf5b..1393340 100644 --- a/postgres_settings_memory.sql +++ b/postgres_settings_memory.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_misc.sql b/postgres_settings_misc.sql index 991a9e3..cb68719 100644 --- a/postgres_settings_misc.sql +++ b/postgres_settings_misc.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_preset.sql b/postgres_settings_preset.sql index b131a4f..e05ec4b 100644 --- a/postgres_settings_preset.sql +++ b/postgres_settings_preset.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_query_planning.sql b/postgres_settings_query_planning.sql index 9e47533..bd8aeea 100644 --- a/postgres_settings_query_planning.sql +++ b/postgres_settings_query_planning.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_replication.sql b/postgres_settings_replication.sql index 8b22e16..bc5f36f 100644 --- a/postgres_settings_replication.sql +++ b/postgres_settings_replication.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_resources.sql b/postgres_settings_resources.sql index 29c0419..16eb9a8 100644 --- a/postgres_settings_resources.sql +++ b/postgres_settings_resources.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_ssl.sql b/postgres_settings_ssl.sql index 86d5c5a..0a144a4 100644 --- a/postgres_settings_ssl.sql +++ b/postgres_settings_ssl.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_statistics.sql b/postgres_settings_statistics.sql index 2947d0d..df341b5 100644 --- a/postgres_settings_statistics.sql +++ b/postgres_settings_statistics.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_settings_wal.sql b/postgres_settings_wal.sql index f7c2c79..90d0f3a 100644 --- a/postgres_settings_wal.sql +++ b/postgres_settings_wal.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_tables_by_size.sql b/postgres_tables_by_size.sql index fdfab5b..2149424 100644 --- a/postgres_tables_by_size.sql +++ b/postgres_tables_by_size.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_tables_cache_hit_ratio.sql b/postgres_tables_cache_hit_ratio.sql index aabbe47..97777b1 100644 --- a/postgres_tables_cache_hit_ratio.sql +++ b/postgres_tables_cache_hit_ratio.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_tables_index_usage.sql b/postgres_tables_index_usage.sql index 9af44ce..b6fd3e5 100644 --- a/postgres_tables_index_usage.sql +++ b/postgres_tables_index_usage.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/postgres_tables_row_estimates.sql b/postgres_tables_row_estimates.sql index 0865445..03c9471 100644 --- a/postgres_tables_row_estimates.sql +++ b/postgres_tables_row_estimates.sql @@ -4,7 +4,7 @@ -- -- vim:ts=2:sts=2:sw=2:et:filetype=sql -- --- https://github.com/harisekhon/sql +-- https://github.com/HariSekhon/SQL-scripts -- -- License: see accompanying Hari Sekhon LICENSE file -- diff --git a/test.sh b/test.sh index ce79de1..04a8996 100755 --- a/test.sh +++ b/test.sh @@ -4,7 +4,7 @@ # Author: Hari Sekhon # Date: 2020-08-12 12:13:30 +0100 (Wed, 12 Aug 2020) # -# https://github.com/harisekhon/sql +# https://github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # From c9ffb4793aa90a7f5bda071114a1c1dbc53e8f05 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 1 Jun 2022 16:12:53 +0100 Subject: [PATCH 006/402] added shellcheck.yaml --- .github/workflows/shellcheck.yaml | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/shellcheck.yaml diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml new file mode 100644 index 0000000..3600c5d --- /dev/null +++ b/.github/workflows/shellcheck.yaml @@ -0,0 +1,54 @@ +# +# Author: Hari Sekhon +# Date: Tue Feb 4 09:53:28 2020 +0000 +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +--- +name: ShellCheck + +on: + push: + branches: + - master + - main + paths: + - '**/*.sh' + - .github/workflows/shellcheck.yaml + pull_request: + branches: + - master + - main + paths: + - '**/*.sh' + - .github/workflows/shellcheck.yaml + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + +permissions: + contents: read + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + shellcheck: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: ShellCheck + uses: HariSekhon/GitHub-Actions/.github/workflows/shellcheck.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From 9c2439ec11dc7549dc890a8199444350168b6fdb Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 1 Jun 2022 16:13:33 +0100 Subject: [PATCH 007/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b786b79..b550e9f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ SQL Scripts [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) +[![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) [![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) From 819913f7c08831e872d769a485deb6fae64f16a5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 1 Jun 2022 18:02:21 +0100 Subject: [PATCH 008/402] updated URLs --- .editorconfig | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 097285b..b4b356b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,7 @@ # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback # to help improve or steer this or other code I publish # -# http://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # http://EditorConfig.org diff --git a/.travis.yml b/.travis.yml index f773634..202277d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback # to help improve or steer this or other code I publish # -# http://www.linkedin.com/in/harisekhon +# https://www.linkedin.com/in/HariSekhon # # ============================================================================ # From 4e1aea0b54bbe88cab3d2ea6de652f77fe495ae8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 16:53:38 +0100 Subject: [PATCH 009/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b550e9f..68197a9 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ SQL Scripts [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) +[![Semgrep Cloud](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml) [![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) [![Travis CI](https://img.shields.io/badge/TravisCI-ready-blue?logo=travis&label=Travis%20CI)](https://github.com/HariSekhon/SQL-scripts/blob/master/.travis.yml) From ef2fe960ee7555a1d14cb213a3a1a9de16e7b1c6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 18:44:39 +0100 Subject: [PATCH 010/402] added xml.yaml --- .github/workflows/xml.yaml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/xml.yaml diff --git a/.github/workflows/xml.yaml b/.github/workflows/xml.yaml new file mode 100644 index 0000000..9744f5c --- /dev/null +++ b/.github/workflows/xml.yaml @@ -0,0 +1,48 @@ +# +# Author: Hari Sekhon +# Date: Tue Feb 4 09:53:28 2020 +0000 +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +--- +name: XML + +on: + push: + branches: + - master + - main + paths: + - '**/*.xml' + pull_request: + branches: + - master + - main + paths: + - '**/*.xml' + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + schedule: + - cron: '0 0 * * 1' + +permissions: + contents: read + +jobs: + check_xml: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: Check XML + uses: HariSekhon/GitHub-Actions/.github/workflows/xml.yaml@master From 4dd7b1134baccda752fe70c2abb01838f4b5938d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 18:46:46 +0100 Subject: [PATCH 011/402] updated json.yaml --- .github/workflows/json.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/json.yaml b/.github/workflows/json.yaml index 63da2d4..adc858e 100644 --- a/.github/workflows/json.yaml +++ b/.github/workflows/json.yaml @@ -21,12 +21,14 @@ on: - main paths: - '**/*.json' + - .github/workflows/json.yaml pull_request: branches: - master - main paths: - '**/*.json' + - .github/workflows/json.yaml workflow_dispatch: inputs: debug: From 59ccc73e73caab6106761c169f0ef3466fade3df Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 18:46:48 +0100 Subject: [PATCH 012/402] updated validate.yaml --- .github/workflows/validate.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 7dd9421..659e81f 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -33,8 +33,8 @@ on: type: boolean required: false default: false - schedule: - - cron: '0 0 * * 1' + #schedule: + # - cron: '0 0 * * 1' permissions: contents: read @@ -50,3 +50,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Validate uses: HariSekhon/GitHub-Actions/.github/workflows/validate.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From bbf6f2a2b5653b556080be94a46b7e769ac15080 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 18:46:50 +0100 Subject: [PATCH 013/402] updated xml.yaml --- .github/workflows/xml.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/xml.yaml b/.github/workflows/xml.yaml index 9744f5c..3528b90 100644 --- a/.github/workflows/xml.yaml +++ b/.github/workflows/xml.yaml @@ -21,12 +21,14 @@ on: - main paths: - '**/*.xml' + - .github/workflows/xml.yaml pull_request: branches: - master - main paths: - '**/*.xml' + - .github/workflows/xml.yaml workflow_dispatch: inputs: debug: From 379a034f034cb699b86df6b10f4343563719473c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 14 Jun 2022 18:46:51 +0100 Subject: [PATCH 014/402] updated yaml.yaml --- .github/workflows/yaml.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml index b980e2c..b480486 100644 --- a/.github/workflows/yaml.yaml +++ b/.github/workflows/yaml.yaml @@ -22,6 +22,7 @@ on: paths: - '**/*.yml' - '**/*.yaml' + - .github/workflows/yaml.yaml pull_request: branches: - master @@ -29,6 +30,7 @@ on: paths: - '**/*.yml' - '**/*.yaml' + - .github/workflows/yaml.yaml workflow_dispatch: inputs: debug: From 6c8f426c05786f9da67464808ae95bc79df11ea7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 15 Jun 2022 10:58:31 +0100 Subject: [PATCH 015/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 68197a9..3c57d26 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ SQL Scripts [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) +[![YAML](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) [![Semgrep Cloud](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml) From 64fb32af2abd9e320211b1ef807e86a858dc474b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 16 Jun 2022 19:42:06 +0100 Subject: [PATCH 016/402] updated README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c57d26..a1899e0 100644 --- a/README.md +++ b/README.md @@ -108,20 +108,22 @@ source /sql/mysql_sessions.sql - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) -### See Also +## Related Repositories -- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 700+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies +- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 800+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies - [Templates](https://github.com/HariSekhon/Templates) - dozens of Code & Config templates - AWS, GCP, Docker, Jenkins, Terraform, Vagrant, Puppet, Python, Bash, Go, Perl, Java, Scala, Groovy, Maven, SBT, Gradle, Make, GitHub Actions Workflows, CircleCI, Jenkinsfile, Makefile, Dockerfile, docker-compose.yml, M4 etc. - [Kubernetes configs](https://github.com/HariSekhon/Kubernetes-configs) - Kubernetes YAML configs - Best Practices, Tips & Tricks are baked right into the templates for future deployments -- [DevOps Python Tools](https://github.com/HariSekhon/DevOps-Python-tools) - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython +- [Terraform](https://github.com/HariSekhon/Terraform) - Terraform templates for AWS / GCP / Azure / GitHub management -- [The Advanced Nagios Plugins Collection](https://github.com/HariSekhon/Nagios-Plugins) - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux) +- [DevOps Python Tools](https://github.com/HariSekhon/DevOps-Python-tools) - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython - [DevOps Perl Tools](https://github.com/harisekhon/perl-tools) - 25+ DevOps CLI tools for Hadoop, HDFS, Hive, Solr/SolrCloud CLI, Log Anonymizer, Nginx stats & HTTP(S) URL watchers for load balanced web farms, Dockerfiles & SQL ReCaser (MySQL, PostgreSQL, AWS Redshift, Snowflake, Apache Drill, Hive, Impala, Cassandra CQL, Microsoft SQL Server, Oracle, Couchbase N1QL, Dockerfiles, Pig Latin, Neo4j, InfluxDB), Ambari FreeIPA Kerberos, Datameer, Linux... +- [The Advanced Nagios Plugins Collection](https://github.com/HariSekhon/Nagios-Plugins) - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux) + - [HAProxy Configs](https://github.com/HariSekhon/HAProxy-configs) - 80+ HAProxy Configs for Hadoop, Big Data, NoSQL, Docker, Elasticsearch, SolrCloud, HBase, Cloudera, Hortonworks, MapR, MySQL, PostgreSQL, Apache Drill, Hive, Presto, Impala, ZooKeeper, OpenTSDB, InfluxDB, Prometheus, Kibana, Graphite, SSH, RabbitMQ, Redis, Riak, Rancher etc. - [Dockerfiles](https://github.com/HariSekhon/Dockerfiles) - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3 From 206ecb93a7d5db43675674354988770e2561540c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 17 Jun 2022 00:31:02 +0100 Subject: [PATCH 017/402] updated README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a1899e0..553658d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -SQL Scripts -=========== +# SQL Scripts [![GitHub stars](https://img.shields.io/github/stars/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/stargazers) [![GitHub forks](https://img.shields.io/github/forks/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/network) From f5df01d4e4d93ae1e1bfbc077747d497108df79b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 3 Aug 2022 23:00:59 +0100 Subject: [PATCH 018/402] updated bootstrap.sh --- setup/bootstrap.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index c57a990..351d902 100755 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -15,11 +15,11 @@ # Alpine / Wget: # -# wget -O- https://raw.githubusercontent.com/HariSekhon/sql-scripts/master/setup/bootstrap.sh | sh +# wget -O- https://raw.githubusercontent.com/HariSekhon/SQL-scripts/master/setup/bootstrap.sh | sh # # Curl: # -# curl https://raw.githubusercontent.com/HariSekhon/sql-scripts/master/setup/bootstrap.sh | sh +# curl https://raw.githubusercontent.com/HariSekhon/SQL-scripts/master/setup/bootstrap.sh | sh set -eu [ -n "${DEBUG:-}" ] && set -x @@ -27,7 +27,7 @@ srcdir="$(dirname "$0")" repo="https://github.com/HariSekhon/SQL-scripts" -directory="sql-scripts" +directory="sql" sudo="" [ "$(whoami)" = "root" ] || sudo=sudo @@ -81,4 +81,6 @@ else fi fi -make +if [ -z "${NO_MAKE:-}" ]; then + make +fi From 44fd0cc66baff7e6999cbb6ba090a1fa1f1494a9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 3 Aug 2022 23:02:28 +0100 Subject: [PATCH 019/402] added ci_git_set_dir_safe.sh --- setup/ci_git_set_dir_safe.sh | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 setup/ci_git_set_dir_safe.sh diff --git a/setup/ci_git_set_dir_safe.sh b/setup/ci_git_set_dir_safe.sh new file mode 100644 index 0000000..d8b62e1 --- /dev/null +++ b/setup/ci_git_set_dir_safe.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# vim:ts=4:sts=4:sw=4:et +# +# Author: Hari Sekhon +# Date: 2022-08-03 20:07:09 +0100 (Wed, 03 Aug 2022) +# +# https://github.com/HariSekhon/SQL-scripts +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +# Necessary for some CI/CD systems like Azure DevOps Pipelines which have incorrect ownership on the git checkout dir triggering this error: +# +# fatal: detected dubious ownership in repository at '/code/sql' + +# standalone script without lib dependency so it can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules + +set -euo pipefail +[ -n "${DEBUG:-}" ] && set -x +srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +dir="${1:-$srcdir/..}" + +cd "$dir" + +echo "Setting directory as safe: $PWD" +git config --global --add safe.directory "$PWD" + +while read -r submodule_dir; do + dir="$PWD/$submodule_dir" + echo "Setting directory as safe: $dir" + git config --global --add safe.directory "$dir" +done < <(git submodule | awk '{print $2}') + +echo "Done" From 7aa76fd94201e90bc05d5b3c0766b56cd55a38c9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 4 Aug 2022 13:54:10 +0100 Subject: [PATCH 020/402] updated ci_git_set_dir_safe.sh --- setup/ci_git_set_dir_safe.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 setup/ci_git_set_dir_safe.sh diff --git a/setup/ci_git_set_dir_safe.sh b/setup/ci_git_set_dir_safe.sh old mode 100644 new mode 100755 From fa0a59ca990748408802732d50202522b82d52c7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 4 Aug 2022 15:09:53 +0100 Subject: [PATCH 021/402] removed setup/ci_git_set_dir_safe.sh --- setup/ci_git_set_dir_safe.sh | 39 ------------------------------------ 1 file changed, 39 deletions(-) delete mode 100755 setup/ci_git_set_dir_safe.sh diff --git a/setup/ci_git_set_dir_safe.sh b/setup/ci_git_set_dir_safe.sh deleted file mode 100755 index d8b62e1..0000000 --- a/setup/ci_git_set_dir_safe.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -# vim:ts=4:sts=4:sw=4:et -# -# Author: Hari Sekhon -# Date: 2022-08-03 20:07:09 +0100 (Wed, 03 Aug 2022) -# -# https://github.com/HariSekhon/SQL-scripts -# -# License: see accompanying Hari Sekhon LICENSE file -# -# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish -# -# https://www.linkedin.com/in/HariSekhon -# - -# Necessary for some CI/CD systems like Azure DevOps Pipelines which have incorrect ownership on the git checkout dir triggering this error: -# -# fatal: detected dubious ownership in repository at '/code/sql' - -# standalone script without lib dependency so it can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules - -set -euo pipefail -[ -n "${DEBUG:-}" ] && set -x -srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -dir="${1:-$srcdir/..}" - -cd "$dir" - -echo "Setting directory as safe: $PWD" -git config --global --add safe.directory "$PWD" - -while read -r submodule_dir; do - dir="$PWD/$submodule_dir" - echo "Setting directory as safe: $dir" - git config --global --add safe.directory "$dir" -done < <(git submodule | awk '{print $2}') - -echo "Done" From 24cb5b8d0be1448c5eb65d467e3691bd9023628c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:30 +0100 Subject: [PATCH 022/402] updated codeowners.yaml --- .github/workflows/codeowners.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeowners.yaml b/.github/workflows/codeowners.yaml index c089f85..584b8fd 100644 --- a/.github/workflows/codeowners.yaml +++ b/.github/workflows/codeowners.yaml @@ -52,3 +52,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Validate CODEOWNERS uses: HariSekhon/GitHub-Actions/.github/workflows/codeowners.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From 27f4206c8cc1ec7db3901a9d035bb5ddcd758dd9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:31 +0100 Subject: [PATCH 023/402] updated json.yaml --- .github/workflows/json.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/json.yaml b/.github/workflows/json.yaml index adc858e..48a18a0 100644 --- a/.github/workflows/json.yaml +++ b/.github/workflows/json.yaml @@ -48,3 +48,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Check JSON uses: HariSekhon/GitHub-Actions/.github/workflows/json.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From 372148ae049adefbdf0c8b1d3c99e47e84a44b35 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:31 +0100 Subject: [PATCH 024/402] updated kics.yaml --- .github/workflows/kics.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/kics.yaml b/.github/workflows/kics.yaml index 513c632..09b94cf 100644 --- a/.github/workflows/kics.yaml +++ b/.github/workflows/kics.yaml @@ -52,3 +52,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Kics uses: HariSekhon/GitHub-Actions/.github/workflows/kics.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From 442fd8fdc49ddacf8b512582c5844b9c14302a62 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:32 +0100 Subject: [PATCH 025/402] updated semgrep-cloud.yaml --- .github/workflows/semgrep-cloud.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/semgrep-cloud.yaml b/.github/workflows/semgrep-cloud.yaml index 0304744..22d0b73 100644 --- a/.github/workflows/semgrep-cloud.yaml +++ b/.github/workflows/semgrep-cloud.yaml @@ -58,3 +58,5 @@ jobs: uses: HariSekhon/GitHub-Actions/.github/workflows/semgrep-cloud.yaml@master secrets: SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} + with: + debug: ${{ github.event.inputs.debug }} From dae8c70ddbf7111e2181348ce67a6874d51f06af Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:33 +0100 Subject: [PATCH 026/402] updated semgrep.yaml --- .github/workflows/semgrep.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index ae998d9..6c7ebff 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -60,3 +60,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Semgrep GitHub Security Tab uses: HariSekhon/GitHub-Actions/.github/workflows/semgrep.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From ff707a1168889fb3ad759c030f3fc633d23d800f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 1 Sep 2022 14:44:34 +0100 Subject: [PATCH 027/402] updated yaml.yaml --- .github/workflows/yaml.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml index b480486..3cff279 100644 --- a/.github/workflows/yaml.yaml +++ b/.github/workflows/yaml.yaml @@ -54,3 +54,5 @@ jobs: if: github.repository_owner == 'HariSekhon' name: Check YAML uses: HariSekhon/GitHub-Actions/.github/workflows/yaml.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From d4eedc0e2c68c9a43838c89a1d09abf10927a566 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 15 Apr 2023 23:56:15 +0100 Subject: [PATCH 028/402] updated README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 553658d..e484687 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,8 @@ source /sql/mysql_sessions.sql - [Dockerfiles](https://github.com/HariSekhon/Dockerfiles) - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3 +- [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, ArgoCD, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... + [![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) [git.io/SQL](https://git.io/SQL) From 91b7a177be0d8688b3d9b74e5ca7bd0e34c35f9a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 10 May 2023 02:08:45 +0100 Subject: [PATCH 029/402] updated README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e484687..0abd549 100644 --- a/README.md +++ b/README.md @@ -94,18 +94,18 @@ source /sql/mysql_sessions.sql - [mysql.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql.sh) - quickly connect to MySQL / MariaDB with command line switches inferred from environment variables - [postgres.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres.sh) - one-touch PostgreSQL, boots docker container and drops you in to `psql` shell. Version can be given as an argument - [mysqld.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysqld.sh) / [mariadb.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mariadb.sh) - one-touch MySQL / MariaDB, boots docker container and drops you in to `mysql` shell. Version can be given as an argument -- [postgres_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres_foreach_table.sh) / [mysql_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql_foreach_table.sh) - execute templated SQL queries/statements against all or a subset of tables -- [postgres_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres_tables_row_counts.sh) / [mysql_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql_tables_row_counts.sh) - get row counts for all or a subset of tables +- [postgres_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres/postgres_foreach_table.sh) / [mysql_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql/mysql_foreach_table.sh) - execute templated SQL queries/statements against all or a subset of tables +- [postgres_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres/postgres_tables_row_counts.sh) / [mysql_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql/mysql_tables_row_counts.sh) - get row counts for all or a subset of tables - [sqlcase.pl](https://github.com/HariSekhon/DevOps-Perl-tools/blob/master/sqlcase.pl) - autocases your SQL code - I use this a lot and call it via hotkey configured in my [.vimrc](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/.vimrc) - there are `*case.pl` specializations for most of the major RDBMS and distributed SQL systems, even several NoSQL systems, using each one's language specific keywords - Hive & Impala SQL: - - [beeline.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/beeline.sh) - quickly connect to Hive, auto-determines HiveServer2 address, Kerberos & SSL options, ZooKeeper quorum - - [impala_shell.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_shell.sh) - quickly connect to Impala, auto-determines a Hadoop worker node address and Kerberos options (can use an environment variable for a [Load Balancer](https://github.com/HariSekhon/HAProxy-configs/blob/master/impala-jdbc.cfg) setup) - - [hive_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_foreach_table.sh) / [impala_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_foreach_table.sh) - execute templated SQL queries/statements against all or a subset of tables - - [hive_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_row_counts.sh) / [impala_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_row_counts.sh) - get row counts for all or a subset of tables - - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala - - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) + - [beeline.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/beeline.sh) - quickly connect to Hive, auto-determines HiveServer2 address, Kerberos & SSL options, ZooKeeper quorum + - [impala_shell.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_shell.sh) - quickly connect to Impala, auto-determines a Hadoop worker node address and Kerberos options (can use an environment variable for a [Load Balancer](https://github.com/HariSekhon/HAProxy-configs/blob/master/bigdata/impala-jdbc.cfg) setup) + - [hive_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_foreach_table.sh) / [impala_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_foreach_table.sh) - execute templated SQL queries/statements against all or a subset of tables + - [hive_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_row_counts.sh) / [impala_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_row_counts.sh) - get row counts for all or a subset of tables + - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala + - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) ## Related Repositories From 3630b7f3ed55250419bee19fec5d9a539421fc66 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 10 May 2023 03:57:33 +0100 Subject: [PATCH 030/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0abd549..2da08b1 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ source /sql/mysql_sessions.sql - [postgres_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres/postgres_foreach_table.sh) / [mysql_foreach_table.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql/mysql_foreach_table.sh) - execute templated SQL queries/statements against all or a subset of tables - [postgres_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/postgres/postgres_tables_row_counts.sh) / [mysql_tables_row_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/mysql/mysql_tables_row_counts.sh) - get row counts for all or a subset of tables - [sqlcase.pl](https://github.com/HariSekhon/DevOps-Perl-tools/blob/master/sqlcase.pl) - autocases your SQL code - - I use this a lot and call it via hotkey configured in my [.vimrc](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/.vimrc) + - I use this a lot and call it via hotkey configured in my [.vimrc](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/configs/.vimrc) - there are `*case.pl` specializations for most of the major RDBMS and distributed SQL systems, even several NoSQL systems, using each one's language specific keywords - Hive & Impala SQL: - [beeline.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/beeline.sh) - quickly connect to Hive, auto-determines HiveServer2 address, Kerberos & SSL options, ZooKeeper quorum From cb485e26e9db1d9a5d71c3a6642e77a9cfca47ff Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 11 May 2023 23:58:59 +0100 Subject: [PATCH 031/402] updated README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2da08b1..c47e98d 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,10 @@ source /sql/mysql_sessions.sql - [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 800+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies +- [Jenkins](https://github.com/HariSekhon/Jenkins) - Advanced Jenkinsfile & Jenkins Groovy Shared Library + +- [GitHub-Actions](https://github.com/HariSekhon/GitHub-Actions) - GitHub Actions master template & GitHub Actions Shared Workflows library + - [Templates](https://github.com/HariSekhon/Templates) - dozens of Code & Config templates - AWS, GCP, Docker, Jenkins, Terraform, Vagrant, Puppet, Python, Bash, Go, Perl, Java, Scala, Groovy, Maven, SBT, Gradle, Make, GitHub Actions Workflows, CircleCI, Jenkinsfile, Makefile, Dockerfile, docker-compose.yml, M4 etc. - [Kubernetes configs](https://github.com/HariSekhon/Kubernetes-configs) - Kubernetes YAML configs - Best Practices, Tips & Tricks are baked right into the templates for future deployments From ba70d33e44e6aeeb04fbe4bd528f35dd9c7918dc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 13 May 2023 00:36:53 +0100 Subject: [PATCH 032/402] added trivy.yaml --- .github/workflows/trivy.yaml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/trivy.yaml diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml new file mode 100644 index 0000000..6b1fac2 --- /dev/null +++ b/.github/workflows/trivy.yaml @@ -0,0 +1,60 @@ +# +# Author: Hari Sekhon +# Date: Date: 2022-02-02 11:27:37 +0000 (Wed, 02 Feb 2022) +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# T r i v y +# ============================================================================ # + +--- +name: Trivy + +on: + push: + branches: + - master + - main + paths-ignore: + - '**/*.md' + pull_request: + branches: + - master + - main + paths-ignore: + - '**/*.md' + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + schedule: + - cron: '0 0 * * 1' + +permissions: + actions: read + contents: read + security-events: write + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + trivy: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: Trivy Filesystem Scan + uses: HariSekhon/GitHub-Actions/.github/workflows/trivy.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From 98141a986fa795af77de7b5c9b6ddc333ea9696c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 13 May 2023 00:47:03 +0100 Subject: [PATCH 033/402] updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c47e98d..3c75ce7 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![YAML](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) +[![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) [![Semgrep Cloud](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml) -[![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) -[![Travis CI](https://img.shields.io/badge/TravisCI-ready-blue?logo=travis&label=Travis%20CI)](https://github.com/HariSekhon/SQL-scripts/blob/master/.travis.yml) +[![Trivy](https://github.com/HariSekhon/SQL-scripts/actions/workflows/trivy.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/trivy.yaml) [![Linux](https://img.shields.io/badge/OS-Linux-blue?logo=linux)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) [![Mac](https://img.shields.io/badge/OS-Mac-blue?logo=apple)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) From 47596abe347c02b989199d500f159a13b6f94c5f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 13 May 2023 01:08:42 +0100 Subject: [PATCH 034/402] updated trivy.yaml --- .github/workflows/trivy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index 6b1fac2..4e32c34 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -1,6 +1,6 @@ # # Author: Hari Sekhon -# Date: Date: 2022-02-02 11:27:37 +0000 (Wed, 02 Feb 2022) +# Date: 2022-02-02 11:27:37 +0000 (Wed, 02 Feb 2022) # # vim:ts=2:sts=2:sw=2:et # @@ -54,7 +54,7 @@ jobs: # github.event.repository context not available in scheduled workflows #if: github.event.repository.fork == false if: github.repository_owner == 'HariSekhon' - name: Trivy Filesystem Scan + name: Trivy uses: HariSekhon/GitHub-Actions/.github/workflows/trivy.yaml@master with: debug: ${{ github.event.inputs.debug }} From f5a7f8e88ba1ffac6a4ea85da9e8798ff241ceac Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 13 May 2023 01:40:15 +0100 Subject: [PATCH 035/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3c75ce7..954dfcb 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![YAML](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) +[![Grype](https://github.com/HariSekhon/SQL-scripts/actions/workflows/grype.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/grype.yaml) [![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) [![Semgrep](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep.yaml) [![Semgrep Cloud](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/semgrep-cloud.yaml) From 4b1dece68603f633a871cb3cc6dbeae3f49568b4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 13 May 2023 07:12:49 +0100 Subject: [PATCH 036/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 954dfcb..4e51fe6 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ source /sql/mysql_sessions.sql ## Related Repositories -- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 800+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies +- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 1000+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies - [Jenkins](https://github.com/HariSekhon/Jenkins) - Advanced Jenkinsfile & Jenkins Groovy Shared Library From b96c184fdda9b2ad607d222ec5663a087769b561 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sun, 14 May 2023 04:18:24 +0100 Subject: [PATCH 037/402] added grype.yaml --- .github/workflows/grype.yaml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/grype.yaml diff --git a/.github/workflows/grype.yaml b/.github/workflows/grype.yaml new file mode 100644 index 0000000..6c8f15d --- /dev/null +++ b/.github/workflows/grype.yaml @@ -0,0 +1,60 @@ +# +# Author: Hari Sekhon +# Date: 2023-05-13 01:07:56 +0100 (Sat, 13 May 2023) +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# G r y p e +# ============================================================================ # + +--- +name: Grype + +on: + push: + branches: + - master + - main + paths-ignore: + - '**/*.md' + pull_request: + branches: + - master + - main + paths-ignore: + - '**/*.md' + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + schedule: + - cron: '0 0 * * 1' + +permissions: + actions: read + contents: read + security-events: write + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + Grype: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: Grype + uses: HariSekhon/GitHub-Actions/.github/workflows/grype.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From d0159a968daa60f707751dc81295c6fb7d818636 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:46 +0100 Subject: [PATCH 038/402] updated codeowners.yaml --- .github/workflows/codeowners.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeowners.yaml b/.github/workflows/codeowners.yaml index 584b8fd..261c302 100644 --- a/.github/workflows/codeowners.yaml +++ b/.github/workflows/codeowners.yaml @@ -11,8 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# C o d e O w n e r s +# ============================================================================ # + --- -name: Codeowners +name: CodeOwners on: push: From 207b03c3b321dd962e0ed90ce1ae42c655bec493 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:47 +0100 Subject: [PATCH 039/402] updated fork-sync.yaml --- .github/workflows/fork-sync.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/fork-sync.yaml b/.github/workflows/fork-sync.yaml index 28797a0..a9a299d 100644 --- a/.github/workflows/fork-sync.yaml +++ b/.github/workflows/fork-sync.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# F o r k S y n c +# ============================================================================ # + +# For a fork of the original repo, activate to keep it up to date via straight GitHub sync to the default branch + --- name: Fork Sync From f6918a5760060f8d9fdb7d4dde223b5328c4a563 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:48 +0100 Subject: [PATCH 040/402] updated fork-update-pr.yaml --- .github/workflows/fork-update-pr.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/fork-update-pr.yaml b/.github/workflows/fork-update-pr.yaml index 1ebf3ab..f65009d 100644 --- a/.github/workflows/fork-update-pr.yaml +++ b/.github/workflows/fork-update-pr.yaml @@ -11,6 +11,14 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# F o r k U p d a t e P R +# ============================================================================ # + +# For a fork of the original repo, activate to keep its branches up to date via Pull Requests +# +# To be used in conjunction with the adjacent fork-sync.yaml which keeps the default branch up to date + --- name: Fork Update PR From 142281320eee9aebfec2b3dd10da5726613e9698 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:48 +0100 Subject: [PATCH 041/402] updated json.yaml --- .github/workflows/json.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/json.yaml b/.github/workflows/json.yaml index 48a18a0..d009e59 100644 --- a/.github/workflows/json.yaml +++ b/.github/workflows/json.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# J S O N +# ============================================================================ # + +# Validate any JSON files found in the repo + --- name: JSON From 52f3388ef8585470ebffa832e6c936335b847041 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:48 +0100 Subject: [PATCH 042/402] updated kics.yaml --- .github/workflows/kics.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/kics.yaml b/.github/workflows/kics.yaml index 09b94cf..0a61703 100644 --- a/.github/workflows/kics.yaml +++ b/.github/workflows/kics.yaml @@ -11,6 +11,10 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# K i c s +# ============================================================================ # + --- name: Kics From df20a43d6953f4d9eb998b3494817a1612c98184 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:49 +0100 Subject: [PATCH 043/402] updated shellcheck.yaml --- .github/workflows/shellcheck.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml index 3600c5d..bce7014 100644 --- a/.github/workflows/shellcheck.yaml +++ b/.github/workflows/shellcheck.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# S h e l l C h e c k +# ============================================================================ # + +# Validate any shell scripts found in the repo + --- name: ShellCheck From 6cfd0a8986bac16e131d541cb855c2387b5d61e1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:50 +0100 Subject: [PATCH 044/402] updated trivy.yaml --- .github/workflows/trivy.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index 4e32c34..b6e12e6 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -15,6 +15,8 @@ # T r i v y # ============================================================================ # +# Scan files in the local repo + --- name: Trivy From 87c35087f6b8d7665bf3d3cd231820c34ba8f2ca Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:50 +0100 Subject: [PATCH 045/402] updated validate.yaml --- .github/workflows/validate.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 659e81f..49126ff 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# V a l i d a t i o n +# ============================================================================ # + +# Run all custom validations against files in the repo + --- name: Validation From 286462c66733d03bededf3e4d64d641964ecb8db Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:50 +0100 Subject: [PATCH 046/402] updated xml.yaml --- .github/workflows/xml.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/xml.yaml b/.github/workflows/xml.yaml index 3528b90..58c9ba9 100644 --- a/.github/workflows/xml.yaml +++ b/.github/workflows/xml.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# X M L +# ============================================================================ # + +# Validate any XML files found in the repo + --- name: XML From e11486ebd436802d22d1b88bda00c0a9eb3d41b6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 04:10:51 +0100 Subject: [PATCH 047/402] updated yaml.yaml --- .github/workflows/yaml.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml index 3cff279..2f77e9f 100644 --- a/.github/workflows/yaml.yaml +++ b/.github/workflows/yaml.yaml @@ -11,6 +11,12 @@ # https://www.linkedin.com/in/HariSekhon # +# ============================================================================ # +# Y A M L +# ============================================================================ # + +# Validate any YAML files found in the repo + --- name: YAML From 9e38a507fbcbe43eda57091cb92bb8443c3bf87a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 17:46:02 +0100 Subject: [PATCH 048/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e51fe6..f449b73 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ source /sql/mysql_sessions.sql - [Dockerfiles](https://github.com/HariSekhon/Dockerfiles) - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3 -- [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, ArgoCD, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... +- [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python & D2 source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, Jenkins, ArgoCD, Traefik, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... [![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) From bde9000fd83cec4ff59c2cd413e2e77037e0a93f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 17:55:52 +0100 Subject: [PATCH 049/402] updated README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f449b73..92a5c54 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ source /sql/mysql_sessions.sql - [Dockerfiles](https://github.com/HariSekhon/Dockerfiles) - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3 +- [HashiCorp Packer templates](https://github.com/HariSekhon/Packer-templates) - Linux automated bare-metal installs and portable virtual machines OVA format appliances using HashiCorp Packer, Redhat Kickstart, Debian Preseed and Ubuntu AutoInstaller / Cloud-Init + - [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python & D2 source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, Jenkins, ArgoCD, Traefik, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... [![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) From 54cc9cef687ba3a242688866b6af76956f23865c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 2 Jun 2023 18:04:57 +0100 Subject: [PATCH 050/402] updated README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 92a5c54..44b2080 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ source /sql/mysql_sessions.sql - [The Advanced Nagios Plugins Collection](https://github.com/HariSekhon/Nagios-Plugins) - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux) +- [Nagios Plugin Kafka](https://github.com/HariSekhon/Nagios-Plugin-Kafka) - Kafka API pub/sub Nagios Plugin written in Scala with Kerberos support + - [HAProxy Configs](https://github.com/HariSekhon/HAProxy-configs) - 80+ HAProxy Configs for Hadoop, Big Data, NoSQL, Docker, Elasticsearch, SolrCloud, HBase, Cloudera, Hortonworks, MapR, MySQL, PostgreSQL, Apache Drill, Hive, Presto, Impala, ZooKeeper, OpenTSDB, InfluxDB, Prometheus, Kibana, Graphite, SSH, RabbitMQ, Redis, Riak, Rancher etc. - [Dockerfiles](https://github.com/HariSekhon/Dockerfiles) - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3 From 39d0eccb4c160fcee9f09df9bb53c911ca2a387f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 29 Jul 2023 17:45:07 +0100 Subject: [PATCH 051/402] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 44b2080..18fd836 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![GitHub forks](https://img.shields.io/github/forks/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/network) [![Lines of Code](https://img.shields.io/badge/lines%20of%20code-5k-lightgrey?logo=codecademy)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) [![License](https://img.shields.io/github/license/HariSekhon/SQL-scripts)](https://github.com/HariSekhon/SQL-scripts/blob/master/LICENSE) +[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=linkedin)](https://www.linkedin.com/in/HariSekhon/) [![GitHub Last Commit](https://img.shields.io/github/last-commit/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/commits/master) [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) From 8597f692e4e4abd59b58fb24c7fa79449a75c8c0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 7 Mar 2024 01:29:28 +0000 Subject: [PATCH 052/402] updated README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 18fd836..9e8cd19 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ source /sql/mysql_sessions.sql - [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python & D2 source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, Jenkins, ArgoCD, Traefik, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... +- [Knowledge-Base](https://github.com/HariSekhon/Knowledge-Base) - IT Knowledge Base from 20 years in DevOps, Linux, Cloud, Big Data, AWS, GCP etc. + [![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) [git.io/SQL](https://git.io/SQL) From f43b1df9f12913121056b58173bbe3dc07db1fd8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 8 Aug 2024 23:59:52 +0300 Subject: [PATCH 053/402] added .envrc --- .envrc | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..644e4cc --- /dev/null +++ b/.envrc @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +# vim:ts=4:sts=4:sw=4:et +# +# Author: Hari Sekhon +# Date: Mon Feb 22 17:42:01 2021 +0000 +# +# https://github.com/HariSekhon/SQL-scripts +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# D i r E n v +# ============================================================================ # + +# https://direnv.net/man/direnv-stdlib.1.html + +# See Also: +# +# .envrc-aws +# .envrc-gcp +# .envrc-kubernetes + +# direnv stdlib - loads .envrc from parent dir up to / +# +# useful to accumulate parent and child directory .envrc settings eg. adding Kubernetes namespace, ArgoCD app etc. +# +# bypasses security authorization though - use with care +#source_up +# +# source_up must be loaded before set -u otherwise gets this error: +# +# direnv: loading .envrc +# /bin/bash: line 226: $1: unbound variable + +set -euo pipefail +[ -n "${DEBUG:-}" ] && set -x +srcdir="$(cd "$(dirname "$(readlink "${BASH_SOURCE[0]}")" )" && pwd)" + +# ============================================================================ # +# P r e - C o m m i t +# ============================================================================ # + +# Automatically install Pre-Commit Git hooks if not already present + +if [ -f .pre-commit-config.yaml ]; then + if [ -d .git ]; then + if ! [ -f .git/hooks/pre-commit ]; then + pre-commit install + fi + fi +fi + +# ============================================================================ # +# D o c k e r C o m p o s e +# ============================================================================ # + +export COMPOSE_PROJECT_NAME="SQL-scripts" + +# ============================================================================ # +# G i t H u b +# ============================================================================ # + +#export GITHUB_ORGANIZATION=HariSekhon + +# ============================================================================ # +# A n s i b l e +# ============================================================================ # + +# use the local repo's ansible.cfg rather than: +# +# $PWD/ansible.cfg +# ~/.ansible.cfg +# /etc/ansible/ansible.cfg +# +# set this in project repos to ensure user environment ANSIBLE_CONFIG doesn't get used +#export ANSIBLE_CONFIG="/path/to/ansible.cfg" + +# ============================================================================ # +# C l o u d f l a r e +# ============================================================================ # + +#export CLOUDFLARE_EMAIL=hari@... +#export CLOUDFLARE_API_KEY=... # generate here: https://dash.cloudflare.com/profile/api-tokens +#export CLOUDFLARE_TOKEN=... # used by cloudflare_api.sh but not by terraform module + +# export the variables for terraform +#export TF_VAR_cloudflare_email="$CLOUDFLARE_EMAIL" +#export TF_VAR_cloudflare_api_key="$CLOUDFLARE_API_KEY" # must be a key, not a token using the link above + +# ============================================================================ # +# Python, AWS, GCP, Terraform +# ============================================================================ # + + #.envrc-aws \ + #.envrc-gcp \ + #.envrc-terraform \ +for envrc in \ + .envrc-python \ + ; do + if [ -f "$srcdir/$envrc" ]; then + echo + echo "Loading $srcdir/$envrc" + # shellcheck disable=SC1090,SC1091 + . "$srcdir/$envrc" + fi +done + +# ============================================================================ # +# K u b e r n e t e s +# ============================================================================ # + +if [ -f "$srcdir/.envrc-python" ]; then + echo + echo "Loading $srcdir/.envrc-kubernetes" + # XXX: safer to inline .envrc-kubernetes if you're worried about changes to it bypassing 'direnv allow' authorization + # shellcheck disable=SC1090,SC1091 + . "$srcdir/.envrc-kubernetes" docker-desktop +fi + +# ============================================================================ # + +echo +# read .env too +#dotenv From 01eac8bbb44d60b0c28fdd41d9c3ef96c56415fa Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 00:08:06 +0300 Subject: [PATCH 054/402] updated .envrc --- .envrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 644e4cc..e2dffd9 100644 --- a/.envrc +++ b/.envrc @@ -114,7 +114,7 @@ done # K u b e r n e t e s # ============================================================================ # -if [ -f "$srcdir/.envrc-python" ]; then +if [ -f "$srcdir/.envrc-kubernetes" ]; then echo echo "Loading $srcdir/.envrc-kubernetes" # XXX: safer to inline .envrc-kubernetes if you're worried about changes to it bypassing 'direnv allow' authorization From 2e57a1c399f61dcc45c2bfc961c618ba8106c09b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 00:13:53 +0300 Subject: [PATCH 055/402] updated .envrc --- .envrc | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.envrc b/.envrc index e2dffd9..69f4184 100644 --- a/.envrc +++ b/.envrc @@ -93,23 +93,40 @@ export COMPOSE_PROJECT_NAME="SQL-scripts" #export TF_VAR_cloudflare_api_key="$CLOUDFLARE_API_KEY" # must be a key, not a token using the link above # ============================================================================ # -# Python, AWS, GCP, Terraform +# P y t h o n , A W S , G C P , T e r r a f o r m # ============================================================================ # - #.envrc-aws \ - #.envrc-gcp \ - #.envrc-terraform \ -for envrc in \ - .envrc-python \ - ; do +load_if_exists(){ + local envrc="$1" if [ -f "$srcdir/$envrc" ]; then echo echo "Loading $srcdir/$envrc" # shellcheck disable=SC1090,SC1091 . "$srcdir/$envrc" fi +} + + #.envrc-aws \ + #.envrc-gcp \ + #.envrc-terraform \ +for envrc in \ + .envrc-python \ + ; do + load_if_exists "$envrc" done +if [[ "$PWD" =~ /aws/ ]]; then + load_if_exists .envrc-aws +fi + +if [[ "$PWD" =~ /gcp/ ]]; then + load_if_exists .envrc-gcp +fi + +if [[ "$PWD" =~ /(terra(form)?|tf)(/|$) ]]; then + load_if_exists .envrc-terraform +fi + # ============================================================================ # # K u b e r n e t e s # ============================================================================ # From 34599ce1a1ce2ac50f26611b5477a5c03799f49b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 01:17:35 +0300 Subject: [PATCH 056/402] added .envrc-python --- .envrc-python | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .envrc-python diff --git a/.envrc-python b/.envrc-python new file mode 100644 index 0000000..039c861 --- /dev/null +++ b/.envrc-python @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# vim:ts=4:sts=4:sw=4:et +# +# Author: Hari Sekhon +# Date: Mon Feb 22 17:42:01 2021 +0000 +# +# https://github.com/HariSekhon/SQL-scripts +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# P y t h o n D i r E n v +# ============================================================================ # + +# .envrc to auto-load the virtualenv inside the 'venv' directory if present + +# https://direnv.net/man/direnv-stdlib.1.html + +set -euo pipefail +[ -n "${DEBUG:-}" ] && set -x +#srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# this is necessary because newer versions of pip no longer allow you to install PyPI packages in system-packages by default +for venv in "$PWD/venv" "$HOME/venv"; do + if [ -f "$venv/bin/activate" ]; then + echo + echo "Virtualenv directory found in: $venv" + echo + echo "Activating Virtualenv inside the directory: $venv" + + # shellcheck disable=SC1091 + source "$venv/bin/activate" + break + fi +done + +# read .env too +#dotenv From 23542d7918f270bcdd983b7c4bbb3bc067a17e4c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 01:18:36 +0300 Subject: [PATCH 057/402] updated .envrc --- .envrc | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.envrc b/.envrc index 69f4184..2f701ae 100644 --- a/.envrc +++ b/.envrc @@ -36,10 +36,15 @@ # # direnv: loading .envrc # /bin/bash: line 226: $1: unbound variable +# +# source_up causes this error is up .envrc is found in parent directories: +# +# direnv: No ancestor .envrc found set -euo pipefail [ -n "${DEBUG:-}" ] && set -x -srcdir="$(cd "$(dirname "$(readlink "${BASH_SOURCE[0]}")" )" && pwd)" +src="$(readlink -f "${BASH_SOURCE[0]}")" +srcdir="$(cd "$(dirname "$src")" && pwd)" # ============================================================================ # # P r e - C o m m i t @@ -96,19 +101,35 @@ export COMPOSE_PROJECT_NAME="SQL-scripts" # P y t h o n , A W S , G C P , T e r r a f o r m # ============================================================================ # +# XXX: safer to bring all these external .envrc inline if you're worried about changes +# to it bypassing 'direnv allow' authorization load_if_exists(){ + # first arg is a path to a .envrc + # all other args are passed to the sourcing of .envrc - used by .envrc-kubernetes + # to pass the context name 'docker-desktop' to switch to local envrc="$1" - if [ -f "$srcdir/$envrc" ]; then + shift + if ! [[ "$envrc" =~ ^/ ]]; then + envrc="$srcdir/$envrc" + fi + if [ -f "$envrc" ]; then + # prevent looping on symlinks to this .envrc if given + if [ "$(readlink "$envrc")" = "$src" ]; then + return + fi echo - echo "Loading $srcdir/$envrc" + echo "Loading $envrc" # shellcheck disable=SC1090,SC1091 - . "$srcdir/$envrc" + . "$envrc" "$@" fi } +#load_if_exists ~/.envrc + #.envrc-aws \ #.envrc-gcp \ #.envrc-terraform \ +# shellcheck disable=SC2043 for envrc in \ .envrc-python \ ; do @@ -132,11 +153,7 @@ fi # ============================================================================ # if [ -f "$srcdir/.envrc-kubernetes" ]; then - echo - echo "Loading $srcdir/.envrc-kubernetes" - # XXX: safer to inline .envrc-kubernetes if you're worried about changes to it bypassing 'direnv allow' authorization - # shellcheck disable=SC1090,SC1091 - . "$srcdir/.envrc-kubernetes" docker-desktop + load_if_exists .envrc-kubernetes docker-desktop fi # ============================================================================ # From 4af70c5defd475e0e19219f17736b6ddad451fd4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 01:51:22 +0300 Subject: [PATCH 058/402] added .pre-commit-config.yaml --- .pre-commit-config.yaml | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f3c5b16 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,72 @@ +# +# Author: Hari Sekhon +# Date: 2024-08-08 17:34:56 +0300 (Thu, 08 Aug 2024) +# +# vim:ts=2:sts=2:sw=2:et +# +# https///github.com/HariSekhon/Templates +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# P r e - C o m m i t +# ============================================================================ # + +--- +fail_fast: false +#exclude: *.tmp$ + +repos: + + # will accept anything that 'git clone' understands + # this means you can set this to a local git repo to develop your own hook repos interactively + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + # Common errors + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + # Git style + - id: check-added-large-files + - id: check-merge-conflict + - id: check-vcs-permalinks + - id: forbid-new-submodules + # Cross platform + - id: check-case-conflict + - id: mixed-line-ending + args: [--fix=lf] + # Security + - id: detect-aws-credentials + args: ['--allow-missing-credentials'] + + - repo: https://github.com/psf/black + rev: 24.8.0 + hooks: + - id: black + + # Git secrets Leaks + - repo: https://github.com/awslabs/git-secrets.git + # the release tags for 1.2.0, 1.2.1 and 1.3.0 are broken with this error: + # + # /Users/hari/.cache/pre-commit/repo......./.pre-commit-hooks.yaml is not a file + # + rev: 5357e18 + hooks: + - id: git-secrets + + - repo: https://github.com/markdownlint/markdownlint + rev: v0.12.0 + hooks: + - id: markdownlint + name: Markdownlint + description: Run markdownlint on your Markdown files + entry: mdl + language: ruby + files: \.(md|mdown|markdown)$ From 6e7c4048358f78a03571fe161c12931a77fcecc3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 01:57:48 +0300 Subject: [PATCH 059/402] updated .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3c5b16..a916abd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ # # vim:ts=2:sts=2:sw=2:et # -# https///github.com/HariSekhon/Templates +# https///github.com/HariSekhon/SQL-scripts # # License: see accompanying Hari Sekhon LICENSE file # From 978d5a0b0c91bfd6aab38207425b63bdc88f5883 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 9 Aug 2024 20:33:26 +0300 Subject: [PATCH 060/402] updated .envrc --- .envrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.envrc b/.envrc index 2f701ae..c2a1a29 100644 --- a/.envrc +++ b/.envrc @@ -52,11 +52,11 @@ srcdir="$(cd "$(dirname "$src")" && pwd)" # Automatically install Pre-Commit Git hooks if not already present -if [ -f .pre-commit-config.yaml ]; then - if [ -d .git ]; then - if ! [ -f .git/hooks/pre-commit ]; then - pre-commit install - fi +if [ -f .pre-commit-config.yaml ] && + [ -d .git ] && + type -P pre-commit &>/dev/null; then + if ! [ -f .git/hooks/pre-commit ]; then + pre-commit install fi fi From b60b975a466976596672a6dae057d376e1573352 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 10 Aug 2024 00:12:32 +0300 Subject: [PATCH 061/402] updated .editorconfig --- .editorconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index b4b356b..c8c23aa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -40,7 +40,14 @@ end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true -[*.md] +[{*.md,*.hcl,*.tf,*.tfvars}] +indent_size = 2 +indent_style = space +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml,*.yaml] indent_size = 2 indent_style = space end_of_line = lf From a0a99615ec90dd7dbf512722e4441b69033abdbd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 10 Aug 2024 01:49:01 +0300 Subject: [PATCH 062/402] updated .envrc --- .envrc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.envrc b/.envrc index c2a1a29..26bdcb0 100644 --- a/.envrc +++ b/.envrc @@ -98,7 +98,7 @@ export COMPOSE_PROJECT_NAME="SQL-scripts" #export TF_VAR_cloudflare_api_key="$CLOUDFLARE_API_KEY" # must be a key, not a token using the link above # ============================================================================ # -# P y t h o n , A W S , G C P , T e r r a f o r m +# Load External Envrc Files If Present # ============================================================================ # # XXX: safer to bring all these external .envrc inline if you're worried about changes @@ -124,8 +124,15 @@ load_if_exists(){ fi } +# don't do this it may lead to an infinite loop if 'make link' symlinking ~/.envrc to this repo's .envrc +# (which I do to keep Python virtual automatically loaded at all times because recent pip on Python refuses +# to install to system Python) #load_if_exists ~/.envrc +# ============================================================================ # +# P y t h o n +# ============================================================================ # + #.envrc-aws \ #.envrc-gcp \ #.envrc-terraform \ @@ -136,14 +143,26 @@ for envrc in \ load_if_exists "$envrc" done +# ============================================================================ # +# A W S +# ============================================================================ # + if [[ "$PWD" =~ /aws/ ]]; then load_if_exists .envrc-aws fi +# ============================================================================ # +# G C P +# ============================================================================ # + if [[ "$PWD" =~ /gcp/ ]]; then load_if_exists .envrc-gcp fi +# ============================================================================ # +# T e r r a f o r m +# ============================================================================ # + if [[ "$PWD" =~ /(terra(form)?|tf)(/|$) ]]; then load_if_exists .envrc-terraform fi From f6f45676f67ece4c90019a7bcb30461d84106c8f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 10 Aug 2024 12:05:58 +0300 Subject: [PATCH 063/402] updated .envrc --- .envrc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.envrc b/.envrc index 26bdcb0..deae06e 100644 --- a/.envrc +++ b/.envrc @@ -52,10 +52,23 @@ srcdir="$(cd "$(dirname "$src")" && pwd)" # Automatically install Pre-Commit Git hooks if not already present +if ! type -P pre-commit &>/dev/null && + uname -s | grep -q Darwin && + type -P brew &>/dev/null; then + echo + echo "Pre-commit is not installed - installing now..." + echo + brew install pre-commit + echo +fi + if [ -f .pre-commit-config.yaml ] && - [ -d .git ] && - type -P pre-commit &>/dev/null; then - if ! [ -f .git/hooks/pre-commit ]; then + type -P pre-commit &>/dev/null && + git rev-parse --is-inside-work-tree &>/dev/null; then + if ! [ -f "$(git rev-parse --show-toplevel)/.git/hooks/pre-commit" ]; then + echo + echo "Pre-commit hook is not installed in local Git repo checkout - installing now..." + echo pre-commit install fi fi From d134b0b07755f688deecf13f0806c1411cecdd9a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 14 Aug 2024 23:17:27 +0200 Subject: [PATCH 064/402] updated .envrc --- .envrc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.envrc b/.envrc index deae06e..49d74e5 100644 --- a/.envrc +++ b/.envrc @@ -52,14 +52,20 @@ srcdir="$(cd "$(dirname "$src")" && pwd)" # Automatically install Pre-Commit Git hooks if not already present -if ! type -P pre-commit &>/dev/null && - uname -s | grep -q Darwin && - type -P brew &>/dev/null; then - echo - echo "Pre-commit is not installed - installing now..." - echo - brew install pre-commit - echo +if ! type -P pre-commit &>/dev/null; then + if uname -s | grep -q Darwin && + type -P brew &>/dev/null; then + echo + echo "Pre-commit is not installed - installing now using Homebrew..." + echo + brew install pre-commit + echo + elif type -P pip &>/dev/null; then + echo + echo "Pre-commit is not installed - installing now using Pip..." + echo + pip install pre-commit + fi fi if [ -f .pre-commit-config.yaml ] && @@ -188,6 +194,8 @@ if [ -f "$srcdir/.envrc-kubernetes" ]; then load_if_exists .envrc-kubernetes docker-desktop fi +# ============================================================================ # +# . E n v # ============================================================================ # echo From ace6d6400c1f647f2e96bd6dc9b730cf1232847a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 15 Aug 2024 16:32:13 +0200 Subject: [PATCH 065/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e8cd19..5bd6f38 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ [![Linux](https://img.shields.io/badge/OS-Linux-blue?logo=linux)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) [![Mac](https://img.shields.io/badge/OS-Mac-blue?logo=apple)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) -[![Repo on Azure DevOps](https://img.shields.io/badge/repo-Azure%20DevOps-0078D7?logo=azure%20devops)](https://dev.azure.com/harisekhon/GitHub/_git/SQL-scripts) [![Repo on GitHub](https://img.shields.io/badge/repo-GitHub-2088FF?logo=github)](https://github.com/HariSekhon/SQL-scripts) [![Repo on GitLab](https://img.shields.io/badge/repo-GitLab-FCA121?logo=gitlab)](https://gitlab.com/HariSekhon/SQL-scripts) +[![Repo on Azure DevOps](https://img.shields.io/badge/repo-Azure%20DevOps-0078D7?logo=azure%20devops)](https://dev.azure.com/harisekhon/GitHub/_git/SQL-scripts) [![Repo on BitBucket](https://img.shields.io/badge/repo-BitBucket-0052CC?logo=bitbucket)](https://bitbucket.org/HariSekhon/SQL-scripts) [git.io/SQL](https://git.io/SQL) From f435d86b6fee2ea7bd0fc947b995ee3bad06232d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 22 Aug 2024 02:21:19 +0200 Subject: [PATCH 066/402] added .markdownlint.rb --- .markdownlint.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .markdownlint.rb diff --git a/.markdownlint.rb b/.markdownlint.rb new file mode 100644 index 0000000..e69de29 From 2ae25c253395b61d458c251edcb050ae7c353cff Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 22 Aug 2024 02:21:45 +0200 Subject: [PATCH 067/402] updated .pre-commit-config.yaml --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a916abd..8f32823 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,5 +68,6 @@ repos: name: Markdownlint description: Run markdownlint on your Markdown files entry: mdl + args: [-s, .markdownlint.rb] language: ruby files: \.(md|mdown|markdown)$ From 0efa94992ba4971a56d8517503f70c3e76b9b039 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 29 Aug 2024 14:36:02 +0200 Subject: [PATCH 068/402] updated README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5bd6f38..3cc80df 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![GitHub forks](https://img.shields.io/github/forks/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/network) [![Lines of Code](https://img.shields.io/badge/lines%20of%20code-5k-lightgrey?logo=codecademy)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) [![License](https://img.shields.io/github/license/HariSekhon/SQL-scripts)](https://github.com/HariSekhon/SQL-scripts/blob/master/LICENSE) -[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=linkedin)](https://www.linkedin.com/in/HariSekhon/) +[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/) [![GitHub Last Commit](https://img.shields.io/github/last-commit/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/commits/master) [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) @@ -39,8 +39,8 @@ Hari Sekhon Cloud & Big Data Contractor, United Kingdom -[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=linkedin)](https://www.linkedin.com/in/HariSekhon/) -###### (you're welcome to connect with me on LinkedIn) +[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/) +
*(you're welcome to connect with me on LinkedIn)* ### Inventory From 7901a38fa86911526010f7f00fc27e86848941c2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 3 Sep 2024 23:34:38 +0200 Subject: [PATCH 069/402] added .mdlrc --- .mdlrc | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .mdlrc diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 0000000..e69de29 From 71fa984324c06c6384d77af22043b613fa39384a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 3 Sep 2024 23:34:38 +0200 Subject: [PATCH 070/402] added .mdl.rb --- .mdl.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .mdl.rb diff --git a/.mdl.rb b/.mdl.rb new file mode 100644 index 0000000..e69de29 From 6e4f333dae8e52cd34fad5c7cce7be6157215211 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 3 Sep 2024 23:35:09 +0200 Subject: [PATCH 071/402] updated .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f32823..7467ebe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,6 +68,6 @@ repos: name: Markdownlint description: Run markdownlint on your Markdown files entry: mdl - args: [-s, .markdownlint.rb] + args: [-s, .mdl.rb] language: ruby files: \.(md|mdown|markdown)$ From a4db5f44ae41f7329e2cd0a40c44c2053d935a64 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 4 Sep 2024 16:12:41 +0200 Subject: [PATCH 072/402] updated README.md --- README.md | 77 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 3cc80df..9336dd5 100644 --- a/README.md +++ b/README.md @@ -109,38 +109,79 @@ source /sql/mysql_sessions.sql - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) -## Related Repositories +### Stargazers over time -- [DevOps Bash Tools](https://github.com/HariSekhon/DevOps-Bash-tools) - 1000+ DevOps Bash Scripts, Advanced `.bashrc`, `.vimrc`, `.screenrc`, `.tmux.conf`, `.gitconfig`, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies +[![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) -- [Jenkins](https://github.com/HariSekhon/Jenkins) - Advanced Jenkinsfile & Jenkins Groovy Shared Library +[git.io/SQL](https://git.io/SQL) -- [GitHub-Actions](https://github.com/HariSekhon/GitHub-Actions) - GitHub Actions master template & GitHub Actions Shared Workflows library +## More Core Repos -- [Templates](https://github.com/HariSekhon/Templates) - dozens of Code & Config templates - AWS, GCP, Docker, Jenkins, Terraform, Vagrant, Puppet, Python, Bash, Go, Perl, Java, Scala, Groovy, Maven, SBT, Gradle, Make, GitHub Actions Workflows, CircleCI, Jenkinsfile, Makefile, Dockerfile, docker-compose.yml, M4 etc. + -- [Kubernetes configs](https://github.com/HariSekhon/Kubernetes-configs) - Kubernetes YAML configs - Best Practices, Tips & Tricks are baked right into the templates for future deployments +### Knowledge -- [Terraform](https://github.com/HariSekhon/Terraform) - Terraform templates for AWS / GCP / Azure / GitHub management +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Knowledge-Base&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Knowledge-Base) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Diagrams-as-Code&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Diagrams-as-Code) -- [DevOps Python Tools](https://github.com/HariSekhon/DevOps-Python-tools) - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython + -- [HashiCorp Packer templates](https://github.com/HariSekhon/Packer-templates) - Linux automated bare-metal installs and portable virtual machines OVA format appliances using HashiCorp Packer, Redhat Kickstart, Debian Preseed and Ubuntu AutoInstaller / Cloud-Init +### DevOps Code -- [Diagrams-as-Code](https://github.com/HariSekhon/Diagrams-as-Code) - Cloud & Open Source architecture diagrams with Python & D2 source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, Jenkins, ArgoCD, Traefik, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing... +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=DevOps-Bash-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/DevOps-Bash-tools) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=DevOps-Python-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/DevOps-Python-tools) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=DevOps-Perl-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/DevOps-Perl-tools) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=DevOps-Golang-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/DevOps-Golang-tools) -- [Knowledge-Base](https://github.com/HariSekhon/Knowledge-Base) - IT Knowledge Base from 20 years in DevOps, Linux, Cloud, Big Data, AWS, GCP etc. + -[![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) +### Containerization -[git.io/SQL](https://git.io/SQL) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Kubernetes-configs&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Kubernetes-configs) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Dockerfiles&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Dockerfiles) + +### CI/CD + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=GitHub-Actions&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/GitHub-Actions) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Jenkins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Jenkins) + +### DBA - SQL + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=SQL-scripts&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/SQL-scripts) + +### DevOps Reloaded + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugins) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=HAProxy-configs&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/HAProxy-configs) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Templates) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Terraform&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Terraform) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Packer-templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Packer-templates) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugin-Kafka&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugin-Kafka) + +### Misc + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Template-repo&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Template-repo) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-tools) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-playlists&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-playlists) + +The rest of my original source repos are +[here](https://github.com/HariSekhon?tab=repositories&q=&type=source&language=&sort=stargazers). + +Pre-built Docker images are available on my [DockerHub](https://hub.docker.com/u/harisekhon/). + + +![](https://hit.yhype.me/github/profile?user_id=2211051) + + From 3c908d5f444ce10019cac1e9e186e7d2ed96fab4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 4 Sep 2024 16:38:20 +0200 Subject: [PATCH 073/402] updated README.md --- README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9336dd5..b2368b5 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ Cloud & Big Data Contractor, United Kingdom [![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/)
*(you're welcome to connect with me on LinkedIn)* -### Inventory +## Inventory -#### DevOps / DBA +### DevOps / DBA - `aws_athena_cloudtrail_ddl.sql` - [AWS Athena](https://aws.amazon.com/athena/) DDL to setup up integration to query [CloudTrail](https://aws.amazon.com/cloudtrail/) logs from Athena - `bigquery_*.sql` - [Google BigQuery](https://cloud.google.com/bigquery) scripts: @@ -60,7 +60,7 @@ Cloud & Big Data Contractor, United Kingdom - [postgres_info.sql](https://github.com/HariSekhon/SQL-scripts/blob/master/postgres_info.sql) - big summary overview, recommend you start here - tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.x -#### Analytics +### Analytics - `bigquery_*.sql` - [Google BigQuery](https://cloud.google.com/bigquery) scripts: - `bigquery_billing_*.sql` - billing queries for [GCP](https://cloud.google.com/) usage eg. highest cost services, most used GCP products, recent charges etc. @@ -68,28 +68,31 @@ Cloud & Big Data Contractor, United Kingdom - [analytics/](https://github.com/HariSekhon/SQL-scripts/tree/master/analytics)`bigquery_*.sql` - ecommerce queries and [BigQuery ML](https://cloud.google.com/bigquery-ml/docs/bigqueryml-intro) machine learning classification logistic regression models and purchasing predictions - for more [BigQuery](https://cloud.google.com/bigquery) examples, see [Data Engineering demos](https://github.com/GoogleCloudPlatform/training-data-analyst/tree/master/courses/data-engineering/demos) -#### DevOps SQL tooling +### DevOps SQL tooling You can quickly test the PostgreSQL / MySQL scripts using `postgres.sh` / `mysqld.sh` / `mariadb.sh` in the [DevOps Bash tools](https://github.com/HariSekhon/DevOps-Bash-tools) repo, which boots a docker container and drops straight in to a `mysql` / `psql` shell with this directory mounted at `/sql` and used as `$PWD` for fast easy sourcing eg. postgres: -``` + +```postgres-sql \i /sql/postgres_query_times.sql ``` -``` + +```postgres-sql \i postgres_query_times.sql ``` mysql: -``` + +```mysql-sql source /sql/mysql_sessions.sql ``` -``` + +```mysql-sql \. mysql_sessions.sql ``` - -#### Related scripts +### Related scripts - [.psqlrc](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/.psqlrc) - advanced PostgreSQL psql client config - [psql.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/psql.sh) - quickly connect to PostgreSQL with command line switches inferred from environment variables @@ -109,7 +112,7 @@ source /sql/mysql_sessions.sql - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) -### Stargazers over time +## Stargazers over time [![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) From b30bede5a67ab81cbf9edfc667435793981f9d15 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 4 Sep 2024 17:17:31 +0200 Subject: [PATCH 074/402] updated README --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2368b5..fccdb59 100644 --- a/README.md +++ b/README.md @@ -168,14 +168,17 @@ Does nothing: [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugins) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=HAProxy-configs&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/HAProxy-configs) -[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Templates) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Terraform&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Terraform) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Packer-templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Packer-templates) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugin-Kafka&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugin-Kafka) -### Misc +### Templates +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Templates) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Template-repo&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Template-repo) + +### Misc + [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-tools) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-playlists&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-playlists) From 575080b548fec8b2420520e161973a861cbbce30 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 19 Sep 2024 01:17:12 +0200 Subject: [PATCH 075/402] removed .markdownlint.rb --- .markdownlint.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .markdownlint.rb diff --git a/.markdownlint.rb b/.markdownlint.rb deleted file mode 100644 index e69de29..0000000 From f098c727b139498c382be5a238ff7dab023b2355 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 24 Sep 2024 00:07:09 +0100 Subject: [PATCH 076/402] updated .envrc --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index 49d74e5..bd53543 100644 --- a/.envrc +++ b/.envrc @@ -201,3 +201,5 @@ fi echo # read .env too #dotenv + +load_if_exists .envrc.local From 482c9a5798017ee4343ae3ff798c97d5596567d9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:37:51 +0300 Subject: [PATCH 077/402] added oracle_checkpoints.sql --- oracle_checkpoints.sql | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 oracle_checkpoints.sql diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql new file mode 100644 index 0000000..6206565 --- /dev/null +++ b/oracle_checkpoints.sql @@ -0,0 +1,25 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + NAME, + checkpoint_time, + file# +FROM + v$datafile +ORDER BY + checkpoint_time; From 126a606dbbab89fba94987992d2af33e95c01397 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:38:48 +0300 Subject: [PATCH 078/402] added oracle_datafiles_lastchanged.sql --- oracle_datafiles_lastchanged.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 oracle_datafiles_lastchanged.sql diff --git a/oracle_datafiles_lastchanged.sql b/oracle_datafiles_lastchanged.sql new file mode 100644 index 0000000..2cb246a --- /dev/null +++ b/oracle_datafiles_lastchanged.sql @@ -0,0 +1,24 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + last_change#, + file# +FROM + v$datafile +ORDER BY + last_change#; From 47e2e7af5b6d076adaedf45058e7d8361538abc7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:39:14 +0300 Subject: [PATCH 079/402] added oracle_datafiles_unrecoverable_change.sql --- oracle_datafiles_unrecoverable_change.sql | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 oracle_datafiles_unrecoverable_change.sql diff --git a/oracle_datafiles_unrecoverable_change.sql b/oracle_datafiles_unrecoverable_change.sql new file mode 100644 index 0000000..8ac159f --- /dev/null +++ b/oracle_datafiles_unrecoverable_change.sql @@ -0,0 +1,24 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + unrecoverable_change#, + file# +FROM + v$datafile +ORDER BY + unrecoverable_change#; From 290ea56e53930c7267592ca7b9a948351b682673 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:39:30 +0300 Subject: [PATCH 080/402] added oracle_user_sid_serial_status.sql --- oracle_user_sid_serial_status.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 oracle_user_sid_serial_status.sql diff --git a/oracle_user_sid_serial_status.sql b/oracle_user_sid_serial_status.sql new file mode 100644 index 0000000..7f7c375 --- /dev/null +++ b/oracle_user_sid_serial_status.sql @@ -0,0 +1,24 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + username, + sid, + serial#, + status +FROM + v$session; From cd2f81554b71bb059200ec831e769f990ce7e2e7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:42:54 +0300 Subject: [PATCH 081/402] added oracle_datafiles_checkpoint_change.sql --- oracle_datafiles_checkpoint_change.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 oracle_datafiles_checkpoint_change.sql diff --git a/oracle_datafiles_checkpoint_change.sql b/oracle_datafiles_checkpoint_change.sql new file mode 100644 index 0000000..8431f78 --- /dev/null +++ b/oracle_datafiles_checkpoint_change.sql @@ -0,0 +1,24 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + checkpoint_change#, + file# +FROM + v$datafile +ORDER BY + checkpoint_change#; From fffc99c1be3e5e0c735aa2afac798154a87fefbf Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:44:09 +0300 Subject: [PATCH 082/402] added oracle_checkpoint_files.sql --- oracle_checkpoint_files.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 oracle_checkpoint_files.sql diff --git a/oracle_checkpoint_files.sql b/oracle_checkpoint_files.sql new file mode 100644 index 0000000..e1b7eb6 --- /dev/null +++ b/oracle_checkpoint_files.sql @@ -0,0 +1,24 @@ +-- +-- Author: Hari Sekhon +-- Date: 2008-04-28 21:36:48 +0100 (Mon, 28 Apr 2008) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle last tested in late 2000s on Oracle 9i - 11 + +SELECT + checkpoint_time, + file# +FROM + v$datafile +ORDER BY + checkpoint_time; From 99551091b4b1772a7194add528097d67686ec33d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:44:15 +0300 Subject: [PATCH 083/402] updated oracle_checkpoints.sql --- oracle_checkpoints.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql index 6206565..ae1e768 100644 --- a/oracle_checkpoints.sql +++ b/oracle_checkpoints.sql @@ -18,7 +18,6 @@ SELECT NAME, checkpoint_time, - file# FROM v$datafile ORDER BY From 593dfffa81273f3c2a494ae683dd2259a9e39d20 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:44:47 +0300 Subject: [PATCH 084/402] renamed oracle_checkpoint_files.sql to oracle_checkpoint_datafiles.sql --- oracle_checkpoint_files.sql => oracle_checkpoint_datafiles.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename oracle_checkpoint_files.sql => oracle_checkpoint_datafiles.sql (100%) diff --git a/oracle_checkpoint_files.sql b/oracle_checkpoint_datafiles.sql similarity index 100% rename from oracle_checkpoint_files.sql rename to oracle_checkpoint_datafiles.sql From f6087ad24c400a93b695c035e043c80c589ccaa5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 12:45:57 +0300 Subject: [PATCH 085/402] renamed oracle_checkpoint_datafiles.sql to oracle_datafiles_checkpoint_time.sql --- ...eckpoint_datafiles.sql => oracle_datafiles_checkpoint_time.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename oracle_checkpoint_datafiles.sql => oracle_datafiles_checkpoint_time.sql (100%) diff --git a/oracle_checkpoint_datafiles.sql b/oracle_datafiles_checkpoint_time.sql similarity index 100% rename from oracle_checkpoint_datafiles.sql rename to oracle_datafiles_checkpoint_time.sql From 499afc297302ef621b1e05aa1e5b236d7c59e8fd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:35:08 +0300 Subject: [PATCH 086/402] updated postgres_active_query_count.sql --- postgres_active_query_count.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgres_active_query_count.sql b/postgres_active_query_count.sql index 8dd041a..b250353 100644 --- a/postgres_active_query_count.sql +++ b/postgres_active_query_count.sql @@ -22,8 +22,8 @@ -- Tested on PostgreSQL 9.2+, 10.x, 11.x, 12.x, 13.0 SELECT - COUNT(*) as active_query_count + COUNT(*) as active_query_count FROM - pg_stat_activity + pg_stat_activity WHERE - state='active'; + state='active'; From 2a9050648f22f35a97f73c6bd292e6ff776191bc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:35:59 +0300 Subject: [PATCH 087/402] added postgres_tables_by_size_2.sql --- postgres_tables_by_size_2.sql | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 postgres_tables_by_size_2.sql diff --git a/postgres_tables_by_size_2.sql b/postgres_tables_by_size_2.sql new file mode 100644 index 0000000..2bb3053 --- /dev/null +++ b/postgres_tables_by_size_2.sql @@ -0,0 +1,30 @@ +-- +-- Author: Hari Sekhon +-- Date: 2022-05-18 18:06:53 +0100 (Wed, 18 May 2022) +-- +-- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- PostgreSQL tables by size +-- +-- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 + +SELECT + schemaname AS table_schema, + relname AS TABLE_NAME, + pg_size_pretty(pg_total_relation_size(relid)) AS total_size, + pg_size_pretty(pg_relation_size(relid)) AS data_size, + pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS external_size +FROM + pg_catalog.pg_statio_user_tables +ORDER BY + pg_total_relation_size(relid) DESC, + pg_relation_size(relid) DESC; From ea031dc01d22f8f769cd5ab56479f981aaed11d8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:47 +0300 Subject: [PATCH 088/402] updated bigquery_billing_commonly_charged_units_of_measure.sql --- bigquery_billing_commonly_charged_units_of_measure.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_billing_commonly_charged_units_of_measure.sql b/bigquery_billing_commonly_charged_units_of_measure.sql index 5c1e18a..c0121c2 100644 --- a/bigquery_billing_commonly_charged_units_of_measure.sql +++ b/bigquery_billing_commonly_charged_units_of_measure.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-02-02 00:37:06 +0000 (Sun, 02 Feb 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From a4e7c59d698a738833f24860d8bdeae5c670bb58 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:48 +0300 Subject: [PATCH 089/402] updated bigquery_billing_latest_100_charges.sql --- bigquery_billing_latest_100_charges.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_billing_latest_100_charges.sql b/bigquery_billing_latest_100_charges.sql index 6e7a671..5fe1f62 100644 --- a/bigquery_billing_latest_100_charges.sql +++ b/bigquery_billing_latest_100_charges.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-02-02 00:37:06 +0000 (Sun, 02 Feb 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 5a2cd8f875416c27a8d56d50ffcd34955c6106fd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:48 +0300 Subject: [PATCH 090/402] updated bigquery_billing_products_most_frequently_used.sql --- bigquery_billing_products_most_frequently_used.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_billing_products_most_frequently_used.sql b/bigquery_billing_products_most_frequently_used.sql index cf7d422..a6d2475 100644 --- a/bigquery_billing_products_most_frequently_used.sql +++ b/bigquery_billing_products_most_frequently_used.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-02-02 00:37:06 +0000 (Sun, 02 Feb 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 31b280f7e5c8211cdfc7543ae40aabdcbf8966a8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:49 +0300 Subject: [PATCH 091/402] updated bigquery_billing_products_with_highest_aggregate_cost.sql --- bigquery_billing_products_with_highest_aggregate_cost.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_billing_products_with_highest_aggregate_cost.sql b/bigquery_billing_products_with_highest_aggregate_cost.sql index 72f0347..0ea4abb 100644 --- a/bigquery_billing_products_with_highest_aggregate_cost.sql +++ b/bigquery_billing_products_with_highest_aggregate_cost.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-02-02 00:37:06 +0000 (Sun, 02 Feb 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 72fc0f2955772e89830798194ccaef00ff3268d6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:50 +0300 Subject: [PATCH 092/402] updated bigquery_billing_products_with_most_billing_records.sql --- bigquery_billing_products_with_most_billing_records.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_billing_products_with_most_billing_records.sql b/bigquery_billing_products_with_most_billing_records.sql index 4ba9cd1..fdf011e 100644 --- a/bigquery_billing_products_with_most_billing_records.sql +++ b/bigquery_billing_products_with_most_billing_records.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-02-02 00:37:06 +0000 (Sun, 02 Feb 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 3516e76d4e6e0256022af30e035baadd12741d80 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:50 +0300 Subject: [PATCH 093/402] updated bigquery_info_biggest_public_tables_by_row_count.sql --- bigquery_info_biggest_public_tables_by_row_count.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index 4a642b3..6d2f646 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-16 08:48:42 +0100 (Wed, 16 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 019d1d014ec77c6d9504f3dfe8b3ad3fb5dc7a20 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:51 +0300 Subject: [PATCH 094/402] updated bigquery_info_columns.sql --- bigquery_info_columns.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_columns.sql b/bigquery_info_columns.sql index 93337f9..a1aa015 100644 --- a/bigquery_info_columns.sql +++ b/bigquery_info_columns.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-16 08:41:30 +0100 (Wed, 16 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From c6813c9e68074b34cdfacdb01774c4dba224a37b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:51 +0300 Subject: [PATCH 095/402] updated bigquery_info_columns_partitioned_clustered.sql --- bigquery_info_columns_partitioned_clustered.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_columns_partitioned_clustered.sql b/bigquery_info_columns_partitioned_clustered.sql index 3ac5e31..c475c62 100644 --- a/bigquery_info_columns_partitioned_clustered.sql +++ b/bigquery_info_columns_partitioned_clustered.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-16 08:44:33 +0100 (Wed, 16 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 7b839d31c3246dd2f3211f12ece06f71aff1d678 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:51 +0300 Subject: [PATCH 096/402] updated bigquery_info_datasets.sql --- bigquery_info_datasets.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_datasets.sql b/bigquery_info_datasets.sql index fe14179..3d99429 100644 --- a/bigquery_info_datasets.sql +++ b/bigquery_info_datasets.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-16 08:29:55 +0100 (Wed, 16 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 4597752a868b4982675c81c7184cff9c9b4f843d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:52 +0300 Subject: [PATCH 097/402] updated bigquery_info_tables.sql --- bigquery_info_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_tables.sql b/bigquery_info_tables.sql index 9cc55cb..507f8da 100644 --- a/bigquery_info_tables.sql +++ b/bigquery_info_tables.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-16 08:29:55 +0100 (Wed, 16 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 09794142de9538301e3a15dd69dcf2d75ae955ff Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:52 +0300 Subject: [PATCH 098/402] updated mysql_databases_by_size.sql --- mysql_databases_by_size.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_databases_by_size.sql b/mysql_databases_by_size.sql index 75bc325..111605c 100644 --- a/mysql_databases_by_size.sql +++ b/mysql_databases_by_size.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-07 01:00:25 +0100 (Fri, 07 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 81eb24fbcce00c03cf055243435dadeaefddd5b4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:53 +0300 Subject: [PATCH 099/402] updated mysql_host_summary.sql --- mysql_host_summary.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_host_summary.sql b/mysql_host_summary.sql index aa43dcc..8d3fb43 100644 --- a/mysql_host_summary.sql +++ b/mysql_host_summary.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 01:51:14 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From e6e43e8d848761c444e20eac028f23b8b0dcfb84 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:53 +0300 Subject: [PATCH 100/402] updated mysql_indexes_unused.sql --- mysql_indexes_unused.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_indexes_unused.sql b/mysql_indexes_unused.sql index 08e59b3..88278e9 100644 --- a/mysql_indexes_unused.sql +++ b/mysql_indexes_unused.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:41:02 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From d4921796544c6b4f8cf038b7537ad2e4cc34a598 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:53 +0300 Subject: [PATCH 101/402] updated mysql_info.sql --- mysql_info.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_info.sql b/mysql_info.sql index 45adb75..9a90c49 100644 --- a/mysql_info.sql +++ b/mysql_info.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:08:00 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From f321872266db0c84923a5be156cfcf841d179644 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:54 +0300 Subject: [PATCH 102/402] updated mysql_memory_by_host.sql --- mysql_memory_by_host.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_memory_by_host.sql b/mysql_memory_by_host.sql index 30f8ed0..a9cd1de 100644 --- a/mysql_memory_by_host.sql +++ b/mysql_memory_by_host.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:13:54 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 26754be00f879b71e533597b15d54cc5b1156a27 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:54 +0300 Subject: [PATCH 103/402] updated mysql_memory_by_user.sql --- mysql_memory_by_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_memory_by_user.sql b/mysql_memory_by_user.sql index 37f96ee..5e80532 100644 --- a/mysql_memory_by_user.sql +++ b/mysql_memory_by_user.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:13:54 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ac4d90218ed5632c61ab43d1d7f09e98e27d1072 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:55 +0300 Subject: [PATCH 104/402] updated mysql_sessions.sql --- mysql_sessions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_sessions.sql b/mysql_sessions.sql index ad92e90..4904f4d 100644 --- a/mysql_sessions.sql +++ b/mysql_sessions.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:13:54 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From f59129ea1da0d76eae9244dcbc7f474a37834244 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:55 +0300 Subject: [PATCH 105/402] updated mysql_statement_latency_by_host.sql --- mysql_statement_latency_by_host.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_statement_latency_by_host.sql b/mysql_statement_latency_by_host.sql index 8e28b42..2a7b90c 100644 --- a/mysql_statement_latency_by_host.sql +++ b/mysql_statement_latency_by_host.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 01:51:14 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 4953ee6670902b25719783ac7300b8d61cfd6a3d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:55 +0300 Subject: [PATCH 106/402] updated mysql_statement_latency_by_user.sql --- mysql_statement_latency_by_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_statement_latency_by_user.sql b/mysql_statement_latency_by_user.sql index ad69960..d7988f2 100644 --- a/mysql_statement_latency_by_user.sql +++ b/mysql_statement_latency_by_user.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 01:51:14 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 2555984a7af92877bcece6e46f431e269289c856 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:56 +0300 Subject: [PATCH 107/402] updated mysql_tables.sql --- mysql_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_tables.sql b/mysql_tables.sql index a4735e4..a8c2182 100644 --- a/mysql_tables.sql +++ b/mysql_tables.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:45:44 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 1a92ee2157924b1357eb7f74b9bf5a836fde5241 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:56 +0300 Subject: [PATCH 108/402] updated mysql_tables_nonsystem.sql --- mysql_tables_nonsystem.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_tables_nonsystem.sql b/mysql_tables_nonsystem.sql index b483a29..338db33 100644 --- a/mysql_tables_nonsystem.sql +++ b/mysql_tables_nonsystem.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:45:44 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From fff3b9ac812f51c92090e7783d35df698adfb2aa Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:57 +0300 Subject: [PATCH 109/402] updated mysql_user.sql --- mysql_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_user.sql b/mysql_user.sql index 213f495..2f2109f 100644 --- a/mysql_user.sql +++ b/mysql_user.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:08:00 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 22da43cc7040fb50e32ade34e703251966250a2b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:57 +0300 Subject: [PATCH 110/402] updated mysql_user_summary.sql --- mysql_user_summary.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_user_summary.sql b/mysql_user_summary.sql index eb1a94f..30b50d5 100644 --- a/mysql_user_summary.sql +++ b/mysql_user_summary.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 01:51:14 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 594e2c34d815f73fe162e16f2c67571af58f0061 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:57 +0300 Subject: [PATCH 111/402] updated mysql_users.sql --- mysql_users.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_users.sql b/mysql_users.sql index eab3c81..5268650 100644 --- a/mysql_users.sql +++ b/mysql_users.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 09:51:00 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 6aec5e8693b64dc11f835683d7fd552bff4797ee Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:58 +0300 Subject: [PATCH 112/402] updated mysql_users_pre56.sql --- mysql_users_pre56.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_users_pre56.sql b/mysql_users_pre56.sql index c99e98c..a692777 100644 --- a/mysql_users_pre56.sql +++ b/mysql_users_pre56.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 09:51:00 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 6b55448516982b67b67265276f1a31077be26fca Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:58 +0300 Subject: [PATCH 113/402] updated mysql_users_pre8.sql --- mysql_users_pre8.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_users_pre8.sql b/mysql_users_pre8.sql index f304e5b..cd07125 100644 --- a/mysql_users_pre8.sql +++ b/mysql_users_pre8.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 09:51:00 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 993b162c84fbf9ce81feb8181efb5aae9f25b4ee Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:59 +0300 Subject: [PATCH 114/402] updated mysql_views.sql --- mysql_views.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_views.sql b/mysql_views.sql index 7b3ae45..5eb7926 100644 --- a/mysql_views.sql +++ b/mysql_views.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-08 09:54:19 +0100 (Sat, 08 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 68566c6df12a2a321a71a53e31fb6b2081e940d6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:59 +0300 Subject: [PATCH 115/402] updated mysql_views_system.sql --- mysql_views_system.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_views_system.sql b/mysql_views_system.sql index f63fa62..c590915 100644 --- a/mysql_views_system.sql +++ b/mysql_views_system.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 02:45:44 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From e6b730706ba4fd26544ade05a8459b77949d4d9d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:37:59 +0300 Subject: [PATCH 116/402] updated postgres_active_query_count.sql --- postgres_active_query_count.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_active_query_count.sql b/postgres_active_query_count.sql index b250353..1f2de24 100644 --- a/postgres_active_query_count.sql +++ b/postgres_active_query_count.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 15:33:36 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 06e42fb122c79252fa4b975547200de773fa5a58 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:00 +0300 Subject: [PATCH 117/402] updated postgres_backends_per_database.sql --- postgres_backends_per_database.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_backends_per_database.sql b/postgres_backends_per_database.sql index 426d25e..8b6acc3 100644 --- a/postgres_backends_per_database.sql +++ b/postgres_backends_per_database.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-17 20:17:18 +0100 (Mon, 17 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From b5d3e8b46aff7f7650262750d8d008bc613fd5cd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:00 +0300 Subject: [PATCH 118/402] updated postgres_blocked_queries.sql --- postgres_blocked_queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_blocked_queries.sql b/postgres_blocked_queries.sql index a7d8042..21e115f 100644 --- a/postgres_blocked_queries.sql +++ b/postgres_blocked_queries.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:53:54 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 0bb7fad6f6208011bf972a8600f9fb88453ad3de Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:01 +0300 Subject: [PATCH 119/402] updated postgres_columns_null.sql --- postgres_columns_null.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_columns_null.sql b/postgres_columns_null.sql index 32b7001..472ee0d 100644 --- a/postgres_columns_null.sql +++ b/postgres_columns_null.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-10-20 11:01:44 +0100 (Tue, 20 Oct 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ca5f494c7fb458f7f3f8ffd672fe525c5ae46619 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:01 +0300 Subject: [PATCH 120/402] updated postgres_columns_useless.sql --- postgres_columns_useless.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_columns_useless.sql b/postgres_columns_useless.sql index c997507..24c7bd0 100644 --- a/postgres_columns_useless.sql +++ b/postgres_columns_useless.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-10-20 11:01:44 +0100 (Tue, 20 Oct 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 2f5c4333e564f1afe59c6ec0ba72ed9b7f2c4f86 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:02 +0300 Subject: [PATCH 121/402] updated postgres_databases_by_size.sql --- postgres_databases_by_size.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_databases_by_size.sql b/postgres_databases_by_size.sql index a49b92e..8bc87e8 100644 --- a/postgres_databases_by_size.sql +++ b/postgres_databases_by_size.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 14:54:12 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 08a5c5b872571070d1611d0544c104834ae828e8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:02 +0300 Subject: [PATCH 122/402] updated postgres_databases_by_size_if_accessible.sql --- postgres_databases_by_size_if_accessible.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_databases_by_size_if_accessible.sql b/postgres_databases_by_size_if_accessible.sql index c4b7589..73eb057 100644 --- a/postgres_databases_by_size_if_accessible.sql +++ b/postgres_databases_by_size_if_accessible.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:49:13 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 3cf3f73e51ec84e8d183c3f3867dbcd3e7b0d9d0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:02 +0300 Subject: [PATCH 123/402] updated postgres_dirs.sql --- postgres_dirs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_dirs.sql b/postgres_dirs.sql index 6142945..4fb12a3 100644 --- a/postgres_dirs.sql +++ b/postgres_dirs.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:34:23 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 79173161657b5ef2e3e72b3b26970a1c2353cf08 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:03 +0300 Subject: [PATCH 124/402] updated postgres_dirs_pre10.sql --- postgres_dirs_pre10.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_dirs_pre10.sql b/postgres_dirs_pre10.sql index 3a92ec5..f2a69d8 100644 --- a/postgres_dirs_pre10.sql +++ b/postgres_dirs_pre10.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:34:23 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 67e61f9fc9af71c18932b7a3c87e9ee242ab4da5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:03 +0300 Subject: [PATCH 125/402] updated postgres_dirs_pre11.9.sql --- postgres_dirs_pre11.9.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_dirs_pre11.9.sql b/postgres_dirs_pre11.9.sql index b910b63..d589061 100644 --- a/postgres_dirs_pre11.9.sql +++ b/postgres_dirs_pre11.9.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:34:23 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 4c4ef518eba861d0d0960c8c6cc1d8aca368a121 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:04 +0300 Subject: [PATCH 126/402] updated postgres_grant_select_all_tables.sql --- postgres_grant_select_all_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_grant_select_all_tables.sql b/postgres_grant_select_all_tables.sql index 96353cf..258cb71 100644 --- a/postgres_grant_select_all_tables.sql +++ b/postgres_grant_select_all_tables.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2021-02-01 17:33:17 +0000 (Mon, 01 Feb 2021) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 1637e938e682472c3336e005f63d61e874abd7d3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:04 +0300 Subject: [PATCH 127/402] updated postgres_idle_sessions.sql --- postgres_idle_sessions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_idle_sessions.sql b/postgres_idle_sessions.sql index 4a023ab..c3e06a1 100644 --- a/postgres_idle_sessions.sql +++ b/postgres_idle_sessions.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:34:44 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 0ae2f242aab3c3ebc0e3ea3fb277a02e7a5b9b33 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:04 +0300 Subject: [PATCH 128/402] updated postgres_idle_sessions_current_db_kill.sql --- postgres_idle_sessions_current_db_kill.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_idle_sessions_current_db_kill.sql b/postgres_idle_sessions_current_db_kill.sql index 52dd8fd..9ce58f4 100644 --- a/postgres_idle_sessions_current_db_kill.sql +++ b/postgres_idle_sessions_current_db_kill.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:00:35 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 7e729f5a8425125ba1064467625a72782791dc35 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:05 +0300 Subject: [PATCH 129/402] updated postgres_idle_sessions_current_db_kill_pre92.sql --- postgres_idle_sessions_current_db_kill_pre92.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_idle_sessions_current_db_kill_pre92.sql b/postgres_idle_sessions_current_db_kill_pre92.sql index b5ed2ac..17cb8f6 100644 --- a/postgres_idle_sessions_current_db_kill_pre92.sql +++ b/postgres_idle_sessions_current_db_kill_pre92.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:00:35 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From c9bcc070595ca8613fc94ff3a4fa4405532d2d63 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:05 +0300 Subject: [PATCH 130/402] updated postgres_idle_sessions_kill.sql --- postgres_idle_sessions_kill.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_idle_sessions_kill.sql b/postgres_idle_sessions_kill.sql index b2e0b18..373a473 100644 --- a/postgres_idle_sessions_kill.sql +++ b/postgres_idle_sessions_kill.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:00:35 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 0fac32be25fd00801c9dc43afe64b1d4e8d37efc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:05 +0300 Subject: [PATCH 131/402] updated postgres_idle_sessions_pre92.sql --- postgres_idle_sessions_pre92.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_idle_sessions_pre92.sql b/postgres_idle_sessions_pre92.sql index 9c47f4f..d9bb9c8 100644 --- a/postgres_idle_sessions_pre92.sql +++ b/postgres_idle_sessions_pre92.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:34:44 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ccd462c89db775aa9e7fe7be47807ed3328104cf Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:06 +0300 Subject: [PATCH 132/402] updated postgres_index_cardinality.sql --- postgres_index_cardinality.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_index_cardinality.sql b/postgres_index_cardinality.sql index 1b8ae51..735555b 100644 --- a/postgres_index_cardinality.sql +++ b/postgres_index_cardinality.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:18:01 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ec82e8b472942d39af859de75198e12944c7f650 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:06 +0300 Subject: [PATCH 133/402] updated postgres_index_cardinality_with_schema_name.sql --- postgres_index_cardinality_with_schema_name.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_index_cardinality_with_schema_name.sql b/postgres_index_cardinality_with_schema_name.sql index eb00745..cf98912 100644 --- a/postgres_index_cardinality_with_schema_name.sql +++ b/postgres_index_cardinality_with_schema_name.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:18:01 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 8e8fb596001d00c9383b1654a852e58da713f1db Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:06 +0300 Subject: [PATCH 134/402] updated postgres_indexes_cache_hit_ratio.sql --- postgres_indexes_cache_hit_ratio.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_indexes_cache_hit_ratio.sql b/postgres_indexes_cache_hit_ratio.sql index 0c8ae36..e51011f 100644 --- a/postgres_indexes_cache_hit_ratio.sql +++ b/postgres_indexes_cache_hit_ratio.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 15:28:12 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 55099dc72086982bcf1d9daa7f624b21869c679d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:07 +0300 Subject: [PATCH 135/402] updated postgres_indexes_unused.sql --- postgres_indexes_unused.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_indexes_unused.sql b/postgres_indexes_unused.sql index 58f8844..c4907b0 100644 --- a/postgres_indexes_unused.sql +++ b/postgres_indexes_unused.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 23:48:47 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 250df92a19f8d6089289464ee5d6ceeac6b8bbf0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:07 +0300 Subject: [PATCH 136/402] updated postgres_info.sql --- postgres_info.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_info.sql b/postgres_info.sql index f08cb81..6e4fb3d 100644 --- a/postgres_info.sql +++ b/postgres_info.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:34:23 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From d15f8bbf04f48acf6badfb8b15b32a73168984e7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:08 +0300 Subject: [PATCH 137/402] updated postgres_info_pre10.sql --- postgres_info_pre10.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_info_pre10.sql b/postgres_info_pre10.sql index e63dbca..2dfa475 100644 --- a/postgres_info_pre10.sql +++ b/postgres_info_pre10.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 10:34:23 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From b857e252a7ed0124165255bac8e3a9788f0ba63e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:08 +0300 Subject: [PATCH 138/402] updated postgres_last_analyze.sql --- postgres_last_analyze.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_analyze.sql b/postgres_last_analyze.sql index 6c8b39d..509a6af 100644 --- a/postgres_last_analyze.sql +++ b/postgres_last_analyze.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 87bedc943a1a52eecf35ceade9e5a8a82b9a0489 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:08 +0300 Subject: [PATCH 139/402] updated postgres_last_analyze_pre94.sql --- postgres_last_analyze_pre94.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_analyze_pre94.sql b/postgres_last_analyze_pre94.sql index c97fa72..0ccac1c 100644 --- a/postgres_last_analyze_pre94.sql +++ b/postgres_last_analyze_pre94.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 98af58c40757a41d03a43010942bd6bd7a2062b6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:09 +0300 Subject: [PATCH 140/402] updated postgres_last_vacuum.sql --- postgres_last_vacuum.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_vacuum.sql b/postgres_last_vacuum.sql index 47ee2cc..4c90136 100644 --- a/postgres_last_vacuum.sql +++ b/postgres_last_vacuum.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 3e961e22566bd3d1d6e4a994e19d16eb8f726ac1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:09 +0300 Subject: [PATCH 141/402] updated postgres_last_vacuum_analyze.sql --- postgres_last_vacuum_analyze.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_vacuum_analyze.sql b/postgres_last_vacuum_analyze.sql index 59a989d..3fa3be4 100644 --- a/postgres_last_vacuum_analyze.sql +++ b/postgres_last_vacuum_analyze.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 09b69f4bd6e8bc3ec2f05f9bf59ff4c3cbf44708 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:09 +0300 Subject: [PATCH 142/402] updated postgres_last_vacuum_analyze_pre94.sql --- postgres_last_vacuum_analyze_pre94.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_vacuum_analyze_pre94.sql b/postgres_last_vacuum_analyze_pre94.sql index 3245b5a..07db7f1 100644 --- a/postgres_last_vacuum_analyze_pre94.sql +++ b/postgres_last_vacuum_analyze_pre94.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 651baae4a43b0794251208a4a729fe1c2eee4532 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:10 +0300 Subject: [PATCH 143/402] updated postgres_last_vacuum_pre91.sql --- postgres_last_vacuum_pre91.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_last_vacuum_pre91.sql b/postgres_last_vacuum_pre91.sql index 06d3714..c3bdd96 100644 --- a/postgres_last_vacuum_pre91.sql +++ b/postgres_last_vacuum_pre91.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:30:04 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 26ca9d64ba8c4e47620c9b4b7f3c6dc3d83dd9da Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:10 +0300 Subject: [PATCH 144/402] updated postgres_locks.sql --- postgres_locks.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_locks.sql b/postgres_locks.sql index 7c29724..c5a26d0 100644 --- a/postgres_locks.sql +++ b/postgres_locks.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:16:55 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 12996f6aa7aa488160c7b9891d112bf3be4e1727 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:10 +0300 Subject: [PATCH 145/402] updated postgres_locks_blocked.sql --- postgres_locks_blocked.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_locks_blocked.sql b/postgres_locks_blocked.sql index a8e26f1..939d155 100644 --- a/postgres_locks_blocked.sql +++ b/postgres_locks_blocked.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:16:55 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 3af29450fe4c957667ff569d0e492e5513b6c31a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:11 +0300 Subject: [PATCH 146/402] updated postgres_locks_blocked_application.sql --- postgres_locks_blocked_application.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_locks_blocked_application.sql b/postgres_locks_blocked_application.sql index 740e035..da9e4f5 100644 --- a/postgres_locks_blocked_application.sql +++ b/postgres_locks_blocked_application.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-07 00:43:13 +0100 (Fri, 07 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 825c09f1764efc77dd315248541b2edd1692d873 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:11 +0300 Subject: [PATCH 147/402] updated postgres_locks_query_age.sql --- postgres_locks_query_age.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_locks_query_age.sql b/postgres_locks_query_age.sql index 769dfd3..67afddb 100644 --- a/postgres_locks_query_age.sql +++ b/postgres_locks_query_age.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-07 00:47:45 +0100 (Fri, 07 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From bedc38c74627d2df0c7fa8b08d875d62e1e0bf96 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:11 +0300 Subject: [PATCH 148/402] updated postgres_locks_query_age_pre92.sql --- postgres_locks_query_age_pre92.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_locks_query_age_pre92.sql b/postgres_locks_query_age_pre92.sql index d94618c..2dec171 100644 --- a/postgres_locks_query_age_pre92.sql +++ b/postgres_locks_query_age_pre92.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-07 00:47:45 +0100 (Fri, 07 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 5d07c98b74f52a7cc35eaae55119a4381e12f2c5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:12 +0300 Subject: [PATCH 149/402] updated postgres_queries_slow.sql --- postgres_queries_slow.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_queries_slow.sql b/postgres_queries_slow.sql index ecafbce..f131224 100644 --- a/postgres_queries_slow.sql +++ b/postgres_queries_slow.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:24:59 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 29b0e40aed7005b3cd561ced8d1250096c40b563 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:12 +0300 Subject: [PATCH 150/402] updated postgres_queries_slow_pre92.sql --- postgres_queries_slow_pre92.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_queries_slow_pre92.sql b/postgres_queries_slow_pre92.sql index 7c336fa..3294aaf 100644 --- a/postgres_queries_slow_pre92.sql +++ b/postgres_queries_slow_pre92.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:24:59 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 4fd964b0a5c1c4852c1b5b609f398ad8217e40f2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:12 +0300 Subject: [PATCH 151/402] updated postgres_queries_slow_pre96.sql --- postgres_queries_slow_pre96.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_queries_slow_pre96.sql b/postgres_queries_slow_pre96.sql index 446d178..70d3b5d 100644 --- a/postgres_queries_slow_pre96.sql +++ b/postgres_queries_slow_pre96.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:24:59 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From fef4b93a3110e0f406bd7215a05f4d9e1015f773 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:13 +0300 Subject: [PATCH 152/402] updated postgres_query_cache_hit_ratio.sql --- postgres_query_cache_hit_ratio.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_query_cache_hit_ratio.sql b/postgres_query_cache_hit_ratio.sql index 5f89ce1..7adcca7 100644 --- a/postgres_query_cache_hit_ratio.sql +++ b/postgres_query_cache_hit_ratio.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 16:22:42 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 48011266d94ce3d4d7ebadb412b61c82e88a858f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:13 +0300 Subject: [PATCH 153/402] updated postgres_query_times.sql --- postgres_query_times.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_query_times.sql b/postgres_query_times.sql index 6afbab3..0623a80 100644 --- a/postgres_query_times.sql +++ b/postgres_query_times.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 16:16:21 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From af5b737ec048df8141dea671ceb5e863f7358b8b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:13 +0300 Subject: [PATCH 154/402] updated postgres_query_times_pre13.sql --- postgres_query_times_pre13.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_query_times_pre13.sql b/postgres_query_times_pre13.sql index e4337e3..b59ced6 100644 --- a/postgres_query_times_pre13.sql +++ b/postgres_query_times_pre13.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 16:16:21 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 2085d5f74a6ba4474df5835d5359f3c6b87d3dde Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:14 +0300 Subject: [PATCH 155/402] updated postgres_query_times_pre95.sql --- postgres_query_times_pre95.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_query_times_pre95.sql b/postgres_query_times_pre95.sql index 4368322..9f6b58c 100644 --- a/postgres_query_times_pre95.sql +++ b/postgres_query_times_pre95.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 16:16:21 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From eba185ababa502d864fd8f2a5c755ffdc458eb1f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:14 +0300 Subject: [PATCH 156/402] updated postgres_recovery.sql --- postgres_recovery.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_recovery.sql b/postgres_recovery.sql index dd95b83..c1627db 100644 --- a/postgres_recovery.sql +++ b/postgres_recovery.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 11:36:42 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 804eeef3dae824279eaa8be83b485fda732d9b98 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:14 +0300 Subject: [PATCH 157/402] updated postgres_running_queries.sql --- postgres_running_queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_running_queries.sql b/postgres_running_queries.sql index 47e2003..338d883 100644 --- a/postgres_running_queries.sql +++ b/postgres_running_queries.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 12:54:34 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From d249e7f3d131fdc23f1f03ccbea4a69a565a9359 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:15 +0300 Subject: [PATCH 158/402] updated postgres_running_queries_pre92.sql --- postgres_running_queries_pre92.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_running_queries_pre92.sql b/postgres_running_queries_pre92.sql index faa6a16..3d327c7 100644 --- a/postgres_running_queries_pre92.sql +++ b/postgres_running_queries_pre92.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 12:52:58 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From b64c445f8450d5886f45e25512a24fbc2ac0021f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:15 +0300 Subject: [PATCH 159/402] updated postgres_sequences_restart_all.sql --- postgres_sequences_restart_all.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_sequences_restart_all.sql b/postgres_sequences_restart_all.sql index b31c230..914bba2 100644 --- a/postgres_sequences_restart_all.sql +++ b/postgres_sequences_restart_all.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:32:45 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 22f47a9f2141e41298c8e23bb3017618b78d248c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:15 +0300 Subject: [PATCH 160/402] updated postgres_sessions.sql --- postgres_sessions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_sessions.sql b/postgres_sessions.sql index 090719d..77afa40 100644 --- a/postgres_sessions.sql +++ b/postgres_sessions.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:23:40 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ceb6970a1034ad0c3acff3692c5daf24a2b3ef60 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:16 +0300 Subject: [PATCH 161/402] updated postgres_sessions_pre10.sql --- postgres_sessions_pre10.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_sessions_pre10.sql b/postgres_sessions_pre10.sql index 535b947..4427d36 100644 --- a/postgres_sessions_pre10.sql +++ b/postgres_sessions_pre10.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:23:40 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From bc0eccad648e04b780c0a92b9bedca9e7ff7cf80 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:16 +0300 Subject: [PATCH 162/402] updated postgres_sessions_state_count.sql --- postgres_sessions_state_count.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_sessions_state_count.sql b/postgres_sessions_state_count.sql index 426320d..1bddf08 100644 --- a/postgres_sessions_state_count.sql +++ b/postgres_sessions_state_count.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 00:23:40 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 24d51a7b78367cfab93bce6b48eaededdb6c996b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:16 +0300 Subject: [PATCH 163/402] updated postgres_settings.sql --- postgres_settings.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings.sql b/postgres_settings.sql index aac16c9..eb7f453 100644 --- a/postgres_settings.sql +++ b/postgres_settings.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-12 10:36:55 +0100 (Wed, 12 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 0c955ca1090db8ec809dbeb8a6def03a04f7d358 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:17 +0300 Subject: [PATCH 164/402] updated postgres_settings_auth.sql --- postgres_settings_auth.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_auth.sql b/postgres_settings_auth.sql index df66655..34bd991 100644 --- a/postgres_settings_auth.sql +++ b/postgres_settings_auth.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From ebcce20044646428336b1517355ea596bdf404a1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:17 +0300 Subject: [PATCH 165/402] updated postgres_settings_autovacuum.sql --- postgres_settings_autovacuum.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_autovacuum.sql b/postgres_settings_autovacuum.sql index 82b80cb..cbfc06a 100644 --- a/postgres_settings_autovacuum.sql +++ b/postgres_settings_autovacuum.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 0bd74069fc5166e4686d7145e8833df43557620a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:17 +0300 Subject: [PATCH 166/402] updated postgres_settings_client_connection.sql --- postgres_settings_client_connection.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_client_connection.sql b/postgres_settings_client_connection.sql index c62731b..07aa128 100644 --- a/postgres_settings_client_connection.sql +++ b/postgres_settings_client_connection.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From f4edb2b451bedc5f2918b5d0299ecf7c96e394bc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:18 +0300 Subject: [PATCH 167/402] updated postgres_settings_compatibility.sql --- postgres_settings_compatibility.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_compatibility.sql b/postgres_settings_compatibility.sql index c98655d..34ecc0f 100644 --- a/postgres_settings_compatibility.sql +++ b/postgres_settings_compatibility.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 967f0e4f77e9f7ee401f508abee1a2003ed31638 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:18 +0300 Subject: [PATCH 168/402] updated postgres_settings_connections.sql --- postgres_settings_connections.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_connections.sql b/postgres_settings_connections.sql index e7e29ca..c077ddb 100644 --- a/postgres_settings_connections.sql +++ b/postgres_settings_connections.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 06a0fba69b3fb6ef4566d012c224ad3bcbbd4d82 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:18 +0300 Subject: [PATCH 169/402] updated postgres_settings_developer.sql --- postgres_settings_developer.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_developer.sql b/postgres_settings_developer.sql index d0cb0a4..cfa2c80 100644 --- a/postgres_settings_developer.sql +++ b/postgres_settings_developer.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From b09e923b925ead1a45eb2c34d6730c3f2ef46718 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:19 +0300 Subject: [PATCH 170/402] updated postgres_settings_error_handling.sql --- postgres_settings_error_handling.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_error_handling.sql b/postgres_settings_error_handling.sql index 9a85df1..8ac3ea7 100644 --- a/postgres_settings_error_handling.sql +++ b/postgres_settings_error_handling.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From c1232325330f1ef1cc71535e1e7ea17f8ae091f9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:19 +0300 Subject: [PATCH 171/402] updated postgres_settings_files.sql --- postgres_settings_files.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_files.sql b/postgres_settings_files.sql index 5c1e9fb..d2aa4e7 100644 --- a/postgres_settings_files.sql +++ b/postgres_settings_files.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From e32962aacd3e93e08f70125a3d4beabdf7205ff0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:19 +0300 Subject: [PATCH 172/402] updated postgres_settings_locking.sql --- postgres_settings_locking.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_locking.sql b/postgres_settings_locking.sql index 5df1da6..d5afe5c 100644 --- a/postgres_settings_locking.sql +++ b/postgres_settings_locking.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 54e43261556fbd156f65b52e292be0595bd1b3a7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:20 +0300 Subject: [PATCH 173/402] updated postgres_settings_logging.sql --- postgres_settings_logging.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_logging.sql b/postgres_settings_logging.sql index 3aaf385..39613e0 100644 --- a/postgres_settings_logging.sql +++ b/postgres_settings_logging.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 714e2a057e25935599c1b2c9c5520c70e8c0573b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:20 +0300 Subject: [PATCH 174/402] updated postgres_settings_memory.sql --- postgres_settings_memory.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_memory.sql b/postgres_settings_memory.sql index 1393340..cef3de3 100644 --- a/postgres_settings_memory.sql +++ b/postgres_settings_memory.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 1b9ce729dcb0bcb258b2df47611191d77651f8fd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:20 +0300 Subject: [PATCH 175/402] updated postgres_settings_misc.sql --- postgres_settings_misc.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_misc.sql b/postgres_settings_misc.sql index cb68719..6e49a9d 100644 --- a/postgres_settings_misc.sql +++ b/postgres_settings_misc.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 22a06d52166b572aeb7ffb01392ff31153801bee Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:21 +0300 Subject: [PATCH 176/402] updated postgres_settings_preset.sql --- postgres_settings_preset.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_preset.sql b/postgres_settings_preset.sql index e05ec4b..bc20e3f 100644 --- a/postgres_settings_preset.sql +++ b/postgres_settings_preset.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 90991205a00dd834a8fd6ac3aa3e30c00bc2fc14 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:21 +0300 Subject: [PATCH 177/402] updated postgres_settings_query_planning.sql --- postgres_settings_query_planning.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_query_planning.sql b/postgres_settings_query_planning.sql index bd8aeea..f9dba57 100644 --- a/postgres_settings_query_planning.sql +++ b/postgres_settings_query_planning.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 1536f1703520663f886b69c7f5aa4973f392d7da Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:21 +0300 Subject: [PATCH 178/402] updated postgres_settings_replication.sql --- postgres_settings_replication.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_replication.sql b/postgres_settings_replication.sql index bc5f36f..617e270 100644 --- a/postgres_settings_replication.sql +++ b/postgres_settings_replication.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From dcd97b553d1440ed426776f4edf75df3f77687cc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:22 +0300 Subject: [PATCH 179/402] updated postgres_settings_resources.sql --- postgres_settings_resources.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_resources.sql b/postgres_settings_resources.sql index 16eb9a8..7dfff35 100644 --- a/postgres_settings_resources.sql +++ b/postgres_settings_resources.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 133509b642b6e32420ccddd36f2e3593ac4454c4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:22 +0300 Subject: [PATCH 180/402] updated postgres_settings_ssl.sql --- postgres_settings_ssl.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_ssl.sql b/postgres_settings_ssl.sql index 0a144a4..83f89db 100644 --- a/postgres_settings_ssl.sql +++ b/postgres_settings_ssl.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 688210fd8ceed9a2581752722d30e99ba8793fbe Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:22 +0300 Subject: [PATCH 181/402] updated postgres_settings_statistics.sql --- postgres_settings_statistics.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_statistics.sql b/postgres_settings_statistics.sql index df341b5..542ad11 100644 --- a/postgres_settings_statistics.sql +++ b/postgres_settings_statistics.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From a586d2c099d1c8d4cde3f44b5c2034223c3aa943 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:22 +0300 Subject: [PATCH 182/402] updated postgres_settings_wal.sql --- postgres_settings_wal.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_settings_wal.sql b/postgres_settings_wal.sql index 90d0f3a..0ecea9a 100644 --- a/postgres_settings_wal.sql +++ b/postgres_settings_wal.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-06 18:07:25 +0100 (Thu, 06 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 8cf455b6c2a0292e31525f6bcb7e01a772af91f3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:23 +0300 Subject: [PATCH 183/402] updated postgres_tables_by_size.sql --- postgres_tables_by_size.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_tables_by_size.sql b/postgres_tables_by_size.sql index 2149424..dd0d129 100644 --- a/postgres_tables_by_size.sql +++ b/postgres_tables_by_size.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 17:54:19 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 10dc2e2a59a5587a38ab968edae373b05e526846 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:23 +0300 Subject: [PATCH 184/402] updated postgres_tables_by_size_2.sql --- postgres_tables_by_size_2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_tables_by_size_2.sql b/postgres_tables_by_size_2.sql index 2bb3053..6bd10ae 100644 --- a/postgres_tables_by_size_2.sql +++ b/postgres_tables_by_size_2.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2022-05-18 18:06:53 +0100 (Wed, 18 May 2022) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From b8d1c95c05f0f7c719944ef222591adbb45c76d9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:23 +0300 Subject: [PATCH 185/402] updated postgres_tables_cache_hit_ratio.sql --- postgres_tables_cache_hit_ratio.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_tables_cache_hit_ratio.sql b/postgres_tables_cache_hit_ratio.sql index 97777b1..54468b3 100644 --- a/postgres_tables_cache_hit_ratio.sql +++ b/postgres_tables_cache_hit_ratio.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 14:57:37 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 2946c3e8aed76bf8b0ef3d6a4b92c6062602ed39 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:24 +0300 Subject: [PATCH 186/402] updated postgres_tables_index_usage.sql --- postgres_tables_index_usage.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_tables_index_usage.sql b/postgres_tables_index_usage.sql index b6fd3e5..631f8d7 100644 --- a/postgres_tables_index_usage.sql +++ b/postgres_tables_index_usage.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 15:08:23 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 36796b8b0189f06d0daba5af6ccb1d9d3531acc4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:24 +0300 Subject: [PATCH 187/402] updated postgres_tables_row_estimates.sql --- postgres_tables_row_estimates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres_tables_row_estimates.sql b/postgres_tables_row_estimates.sql index 03c9471..e7007a6 100644 --- a/postgres_tables_row_estimates.sql +++ b/postgres_tables_row_estimates.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-08-05 18:21:15 +0100 (Wed, 05 Aug 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 7d8f8b3edf103ce2948789b7ab3fb0865e0ad30e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:40 +0300 Subject: [PATCH 188/402] updated bigquery_ecommerce_conversion_rate.sql --- analytics/bigquery_ecommerce_conversion_rate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ecommerce_conversion_rate.sql b/analytics/bigquery_ecommerce_conversion_rate.sql index 264f210..5d516ef 100644 --- a/analytics/bigquery_ecommerce_conversion_rate.sql +++ b/analytics/bigquery_ecommerce_conversion_rate.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:22:11 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From fc3b865cbf1d3a68ebb20f665e90851dfe58e333 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:40 +0300 Subject: [PATCH 189/402] updated bigquery_ecommerce_purchasers_on_return_visit.sql --- analytics/bigquery_ecommerce_purchasers_on_return_visit.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql index 5b36e88..1bba7ab 100644 --- a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql +++ b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:39:05 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 95168f0665a6259234c1eabc17f213fad8af7c70 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:41 +0300 Subject: [PATCH 190/402] updated bigquery_ecommerce_time_on_site.sql --- analytics/bigquery_ecommerce_time_on_site.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ecommerce_time_on_site.sql b/analytics/bigquery_ecommerce_time_on_site.sql index e8aea5f..7a882f7 100644 --- a/analytics/bigquery_ecommerce_time_on_site.sql +++ b/analytics/bigquery_ecommerce_time_on_site.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:49:38 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 220e2551263a607fd07dcaa75922e1d8742ae84d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:41 +0300 Subject: [PATCH 191/402] updated bigquery_ecommerce_top_5_products.sql --- analytics/bigquery_ecommerce_top_5_products.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ecommerce_top_5_products.sql b/analytics/bigquery_ecommerce_top_5_products.sql index f5ce189..4dbb54b 100644 --- a/analytics/bigquery_ecommerce_top_5_products.sql +++ b/analytics/bigquery_ecommerce_top_5_products.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:36:31 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From e32e180d035ba6ee6fb8e195db3a6b439d7fe656 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:42 +0300 Subject: [PATCH 192/402] updated bigquery_ml_classification_logistic_regression_create_model1.sql --- ...uery_ml_classification_logistic_regression_create_model1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql index 1f2a7af..e24a978 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:54:10 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 5bafac46f310b6c08511122a57b116f583ffedcc Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:42 +0300 Subject: [PATCH 193/402] updated bigquery_ml_classification_logistic_regression_create_model2.sql --- ...uery_ml_classification_logistic_regression_create_model2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql index 50efdc0..0b9b091 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 10:02:02 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 42f8d273210dddb95163e8a4bc7fa008026046a4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:43 +0300 Subject: [PATCH 194/402] updated bigquery_ml_classification_logistic_regression_evaluate_model1.sql --- ...ry_ml_classification_logistic_regression_evaluate_model1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql index 4f00d24..8b41367 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 09:59:49 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 6708179953b18acab1a45584858ad44c6d4fa389 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:44 +0300 Subject: [PATCH 195/402] updated bigquery_ml_classification_logistic_regression_evaluate_model2.sql --- ...ry_ml_classification_logistic_regression_evaluate_model2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql index f8dd5e8..bd16be6 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 10:03:32 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From 7315305793f73ea224689e0690f4a9f852f15778 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:38:44 +0300 Subject: [PATCH 196/402] updated bigquery_ml_classification_logistic_regression_predict_with_model2.sql --- ...l_classification_logistic_regression_predict_with_model2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql index f8ce4e5..8e39cf6 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql @@ -2,7 +2,7 @@ -- Author: Hari Sekhon -- Date: 2020-09-06 10:05:48 +0100 (Sun, 06 Sep 2020) -- --- vim:ts=2:sts=2:sw=2:et:filetype=sql +-- vim:ts=4:sts=4:sw=4:et:filetype=sql -- -- https://github.com/HariSekhon/SQL-scripts -- From a050e744cf45bd5abbe8dd0348aa3edcbfae22c6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:15 +0300 Subject: [PATCH 197/402] updated bigquery_billing_commonly_charged_units_of_measure.sql --- ...ery_billing_commonly_charged_units_of_measure.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bigquery_billing_commonly_charged_units_of_measure.sql b/bigquery_billing_commonly_charged_units_of_measure.sql index c0121c2..e62eda2 100644 --- a/bigquery_billing_commonly_charged_units_of_measure.sql +++ b/bigquery_billing_commonly_charged_units_of_measure.sql @@ -18,13 +18,13 @@ -- commonly charged units of measure SELECT - usage_unit, - COUNT(*) AS billing_records + usage_unit, + COUNT(*) AS billing_records FROM - `myproject.mydata.imported_billing_data` + `myproject.mydata.imported_billing_data` WHERE - cost > 0 + cost > 0 GROUP BY - usage_unit + usage_unit ORDER BY - billing_records DESC; + billing_records DESC; From 1e6f6e0d9ff4b11edf342fc7df2ff3bb982b809d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:19 +0300 Subject: [PATCH 198/402] updated bigquery_billing_latest_100_charges.sql --- bigquery_billing_latest_100_charges.sql | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bigquery_billing_latest_100_charges.sql b/bigquery_billing_latest_100_charges.sql index 5fe1f62..e438950 100644 --- a/bigquery_billing_latest_100_charges.sql +++ b/bigquery_billing_latest_100_charges.sql @@ -18,22 +18,22 @@ -- latest 100 charges SELECT - product, - resource_type, - start_time, - end_time, - cost, - project_id, - project_name, - project_labels_key, - currency, - currency_conversion_rate, - usage_amount, - usage_unit + product, + resource_type, + start_time, + end_time, + cost, + project_id, + project_name, + project_labels_key, + currency, + currency_conversion_rate, + usage_amount, + usage_unit FROM - `myproject.mydataset.imported_billing_data` + `myproject.mydataset.imported_billing_data` WHERE - cost > 0 + cost > 0 ORDER BY - end_time DESC + end_time DESC LIMIT 100; From d397751c33cd57fbc8eac665deeae45701a3f020 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:21 +0300 Subject: [PATCH 199/402] updated bigquery_billing_products_most_frequently_used.sql --- bigquery_billing_products_most_frequently_used.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bigquery_billing_products_most_frequently_used.sql b/bigquery_billing_products_most_frequently_used.sql index a6d2475..f564208 100644 --- a/bigquery_billing_products_most_frequently_used.sql +++ b/bigquery_billing_products_most_frequently_used.sql @@ -18,13 +18,13 @@ -- most frequently used products costing more than 1 dollar SELECT - product, - COUNT(*) AS billing_records + product, + COUNT(*) AS billing_records FROM - `myproject.mydataset.imported_billing_data` + `myproject.mydataset.imported_billing_data` WHERE - cost > 1 + cost > 1 GROUP BY - product + product ORDER BY - billing_records DESC; + billing_records DESC; From f5aeca996f25f7e3d4720f9cc0be1c362cbbb470 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:26 +0300 Subject: [PATCH 200/402] updated bigquery_billing_products_with_highest_aggregate_cost.sql --- ...ry_billing_products_with_highest_aggregate_cost.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bigquery_billing_products_with_highest_aggregate_cost.sql b/bigquery_billing_products_with_highest_aggregate_cost.sql index 0ea4abb..62a5097 100644 --- a/bigquery_billing_products_with_highest_aggregate_cost.sql +++ b/bigquery_billing_products_with_highest_aggregate_cost.sql @@ -18,11 +18,11 @@ -- products with highest aggregate cost SELECT - product, - ROUND(SUM(cost), 2) AS total_cost + product, + ROUND(SUM(cost), 2) AS total_cost FROM - `myproject.mydataset.imported_billing_data` + `myproject.mydataset.imported_billing_data` GROUP BY - product + product ORDER BY - total_cost DESC; + total_cost DESC; From 00d91c4c9d956452d3161dcfb19326b09192f573 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:29 +0300 Subject: [PATCH 201/402] updated bigquery_billing_products_with_most_billing_records.sql --- ...uery_billing_products_with_most_billing_records.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bigquery_billing_products_with_most_billing_records.sql b/bigquery_billing_products_with_most_billing_records.sql index fdf011e..7a66074 100644 --- a/bigquery_billing_products_with_most_billing_records.sql +++ b/bigquery_billing_products_with_most_billing_records.sql @@ -18,11 +18,11 @@ -- products with most billing records SELECT - product, - COUNT(*) AS billing_records + product, + COUNT(*) AS billing_records FROM - `myproject.mydataset.imported_billing_data` + `myproject.mydataset.imported_billing_data` GROUP BY - product + product ORDER BY - billing_records DESC; + billing_records DESC; From 58fa2665eb74ade89630e95e7a55acf274a2934f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:33 +0300 Subject: [PATCH 202/402] updated bigquery_info_biggest_public_tables_by_row_count.sql --- ...nfo_biggest_public_tables_by_row_count.sql | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index 6d2f646..64f9b13 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -33,45 +33,45 @@ -- BigQuery error in ls operation: Access Denied: Project bigquery-public-data: User does not have bigquery.jobs.list permission in project bigquery-public-data. WITH ALL__TABLES__ AS ( - SELECT * FROM `bigquery-public-data.baseball.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.bls.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.census_bureau_usa.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.cloud_storage_geo_index.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.cms_codes.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.fec.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.genomics_cannabis.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.ghcn_d.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.ghcn_m.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.github_repos.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.hacker_news.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.irs_990.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.medicare.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.new_york.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.nlm_rxnorm.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.noaa_gsod.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.open_images.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.samples.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.san_francisco.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.stackoverflow.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.usa_names.__TABLES__` UNION ALL - SELECT * FROM `bigquery-public-data.utility_us.__TABLES__` + SELECT * FROM `bigquery-public-data.baseball.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.bls.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.census_bureau_usa.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.cloud_storage_geo_index.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.cms_codes.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.fec.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.genomics_cannabis.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.ghcn_d.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.ghcn_m.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.github_repos.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.hacker_news.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.irs_990.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.medicare.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.new_york.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.nlm_rxnorm.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.noaa_gsod.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.open_images.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.samples.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.san_francisco.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.stackoverflow.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.usa_names.__TABLES__` UNION ALL + SELECT * FROM `bigquery-public-data.utility_us.__TABLES__` ) SELECT - project_id, - dataset_id, - table_id, - row_count, - ROUND(size_bytes/pow(10,9),2) as size_gb, - TIMESTAMP_MILLIS(creation_time) AS creation_time, - TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, - CASE - WHEN type = 1 THEN 'table' - WHEN type = 2 THEN 'view' - ELSE NULL - END AS type + project_id, + dataset_id, + table_id, + row_count, + ROUND(size_bytes/pow(10,9),2) as size_gb, + TIMESTAMP_MILLIS(creation_time) AS creation_time, + TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, + CASE + WHEN type = 1 THEN 'table' + WHEN type = 2 THEN 'view' + ELSE NULL + END AS type FROM - ALL__TABLES__ + ALL__TABLES__ ORDER BY - row_count DESC, - size_gb DESC + row_count DESC, + size_gb DESC LIMIT 10; From ae48fab8d1298906de15dba6e946d71c0d22d09b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:39:54 +0300 Subject: [PATCH 203/402] updated bigquery_info_columns.sql --- bigquery_info_columns.sql | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bigquery_info_columns.sql b/bigquery_info_columns.sql index a1aa015..cdf280c 100644 --- a/bigquery_info_columns.sql +++ b/bigquery_info_columns.sql @@ -22,21 +22,21 @@ -- https://cloud.google.com/bigquery/docs/tables#columns_view SELECT - table_catalog, - table_schema, - table_name, - column_name, - ordinal_position, - is_nullable, - data_type, - is_generated, - generation_expression, - is_stored, - is_hidden, - is_updatable, - is_system_defined, - is_partitioning_column, - clustering_ordinal_position + table_catalog, + table_schema, + table_name, + column_name, + ordinal_position, + is_nullable, + data_type, + is_generated, + generation_expression, + is_stored, + is_hidden, + is_updatable, + is_system_defined, + is_partitioning_column, + clustering_ordinal_position FROM - -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset - `bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS`; + -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset + `bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS`; From 99c986572c6549d132b5426c7c397c381eedc5e8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:40:04 +0300 Subject: [PATCH 204/402] updated bigquery_info_columns_partitioned_clustered.sql --- bigquery_info_columns_partitioned_clustered.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bigquery_info_columns_partitioned_clustered.sql b/bigquery_info_columns_partitioned_clustered.sql index c475c62..7505b3b 100644 --- a/bigquery_info_columns_partitioned_clustered.sql +++ b/bigquery_info_columns_partitioned_clustered.sql @@ -21,11 +21,11 @@ SELECT - * + * FROM - -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset - `bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS` + -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset + `bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS` WHERE - is_partitioning_column = 'YES' - OR - clustering_ordinal_position IS NOT NULL; + is_partitioning_column = 'YES' + OR + clustering_ordinal_position IS NOT NULL; From b1b3f67b0742f7aa1606ca3ed8af751a74e95fc3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:40:19 +0300 Subject: [PATCH 205/402] updated bigquery_info_datasets.sql --- bigquery_info_datasets.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bigquery_info_datasets.sql b/bigquery_info_datasets.sql index 3d99429..0b0d5f5 100644 --- a/bigquery_info_datasets.sql +++ b/bigquery_info_datasets.sql @@ -20,17 +20,17 @@ -- Processes 20MB SELECT - s.*, - TIMESTAMP_DIFF(CURRENT_TIMESTAMP(), creation_time, DAY) AS days_live, - option_value AS dataset_description + s.*, + TIMESTAMP_DIFF(CURRENT_TIMESTAMP(), creation_time, DAY) AS days_live, + option_value AS dataset_description FROM - -- XXX: can prefix INFORMATION_SCHEMA with your '.' to select from another project, but defaulting to the current project is more convenient than editing this - `INFORMATION_SCHEMA.SCHEMATA` AS s - LEFT JOIN `INFORMATION_SCHEMA.SCHEMATA_OPTIONS` AS so - USING (schema_name) + -- XXX: can prefix INFORMATION_SCHEMA with your '.' to select from another project, but defaulting to the current project is more convenient than editing this + `INFORMATION_SCHEMA.SCHEMATA` AS s + LEFT JOIN `INFORMATION_SCHEMA.SCHEMATA_OPTIONS` AS so + USING (schema_name) -- will miss all the datasets without descriptions like this --WHERE --- so.option_name = 'description' +-- so.option_name = 'description' ORDER BY - last_modified_time DESC + last_modified_time DESC LIMIT 15; From a1eabd87784bc656fd958e6355d68241d211d181 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:40:30 +0300 Subject: [PATCH 206/402] updated bigquery_info_tables.sql --- bigquery_info_tables.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bigquery_info_tables.sql b/bigquery_info_tables.sql index 507f8da..dbec288 100644 --- a/bigquery_info_tables.sql +++ b/bigquery_info_tables.sql @@ -37,21 +37,21 @@ -- SELECT - dataset_id, - table_id, - -- convert bytes to GB - ROUND(size_bytes/pow(10,9),2) as size_gb, - row_count, - -- Convert UNIX EPOCH to a timestamp. - TIMESTAMP_MILLIS(creation_time) AS creation_time, - TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, - CASE - WHEN type = 1 THEN 'table' - WHEN type = 2 THEN 'view' - ELSE NULL - END AS type + dataset_id, + table_id, + -- convert bytes to GB + ROUND(size_bytes/pow(10,9),2) as size_gb, + row_count, + -- Convert UNIX EPOCH to a timestamp. + TIMESTAMP_MILLIS(creation_time) AS creation_time, + TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, + CASE + WHEN type = 1 THEN 'table' + WHEN type = 2 THEN 'view' + ELSE NULL + END AS type FROM - -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset - `bigquery-public-data.github_repos.__TABLES__` + -- XXX: replace bigquery-public-data.github_repos with myproject.mydataset + `bigquery-public-data.github_repos.__TABLES__` ORDER BY - size_gb DESC; + size_gb DESC; From 290217d2ea8d3a3490d69fb289a2f5a31053f8b8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:40:37 +0300 Subject: [PATCH 207/402] updated bigquery_info_biggest_public_tables_by_row_count.sql --- bigquery_info_biggest_public_tables_by_row_count.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index 64f9b13..f9b2332 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -65,8 +65,8 @@ SELECT TIMESTAMP_MILLIS(creation_time) AS creation_time, TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, CASE - WHEN type = 1 THEN 'table' - WHEN type = 2 THEN 'view' + WHEN type = 1 THEN 'table' + WHEN type = 2 THEN 'view' ELSE NULL END AS type FROM From 3657a0693e26e0c6056c6ba46d8cf4c6c78fa820 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:40:57 +0300 Subject: [PATCH 208/402] updated bigquery_info_columns_partitioned_clustered.sql --- bigquery_info_columns_partitioned_clustered.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigquery_info_columns_partitioned_clustered.sql b/bigquery_info_columns_partitioned_clustered.sql index 7505b3b..8350186 100644 --- a/bigquery_info_columns_partitioned_clustered.sql +++ b/bigquery_info_columns_partitioned_clustered.sql @@ -27,5 +27,5 @@ FROM `bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS` WHERE is_partitioning_column = 'YES' - OR + OR clustering_ordinal_position IS NOT NULL; From ba1819434ce3d3cdf35569458696e00c966ae55e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:10 +0300 Subject: [PATCH 209/402] updated mysql_databases_by_size.sql --- mysql_databases_by_size.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql_databases_by_size.sql b/mysql_databases_by_size.sql index 111605c..84d090c 100644 --- a/mysql_databases_by_size.sql +++ b/mysql_databases_by_size.sql @@ -18,12 +18,12 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - table_schema, - ROUND(SUM(data_length + index_length) / 1024 / 1024, 3) AS 'Database Size (MB)', - ROUND(SUM(data_free) / 1024 / 1024, 3) AS 'Free Space (MB)' + table_schema, + ROUND(SUM(data_length + index_length) / 1024 / 1024, 3) AS 'Database Size (MB)', + ROUND(SUM(data_free) / 1024 / 1024, 3) AS 'Free Space (MB)' FROM - information_schema.tables + information_schema.tables GROUP BY - table_schema + table_schema ORDER BY - 2 DESC; + 2 DESC; From 017f9fba0220b533ace08b2e2c775f831cfc01d7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:19 +0300 Subject: [PATCH 210/402] updated mysql_host_summary.sql --- mysql_host_summary.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql_host_summary.sql b/mysql_host_summary.sql index 8d3fb43..1ef1b7f 100644 --- a/mysql_host_summary.sql +++ b/mysql_host_summary.sql @@ -23,8 +23,8 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.host_summary + sys.host_summary ORDER BY - statement_latency DESC; + statement_latency DESC; From f4a17ae78afe68674e99fd2c99a27c561bffc57b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:23 +0300 Subject: [PATCH 211/402] updated mysql_indexes_unused.sql --- mysql_indexes_unused.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql_indexes_unused.sql b/mysql_indexes_unused.sql index 88278e9..5e509c5 100644 --- a/mysql_indexes_unused.sql +++ b/mysql_indexes_unused.sql @@ -35,10 +35,10 @@ SELECT IF (@@performance_schema, 'TRUE', 'FALSE') AS 'Performance Schema enabled \! echo "Unused Indexes since startup:"; SELECT - * + * FROM - sys.schema_unused_indexes + sys.schema_unused_indexes ORDER BY - object_schema, - object_name, - index_name; + object_schema, + object_name, + index_name; From 151b494653945f9547688d61395734188bb66e79 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:32 +0300 Subject: [PATCH 212/402] updated mysql_info.sql --- mysql_info.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mysql_info.sql b/mysql_info.sql index 9a90c49..289d7cf 100644 --- a/mysql_info.sql +++ b/mysql_info.sql @@ -25,18 +25,18 @@ -- some of these allow not using the brackets but use them for portability between MySQL 5.x and 8.x SELECT - VERSION(), - USER(), -- client's reported user + host, same as SESSION_USER(), SYSTEM_USER() - CURRENT_USER(), -- authenticated user name + host name - this is the one you want for debugging your mysql.user table configuration - DATABASE(), -- SCHEMA() - NOW(), - CURDATE(), - CURTIME(), - UTC_DATE(), - UTC_TIME(), - UTC_TIMESTAMP(), - SYSDATE(), -- returns date of function completion - -- PS_CURRENT_THREAD_ID(), -- MySQL 8.0.16+ - UUID_SHORT(), -- integer - UUID() -- alnum + VERSION(), + USER(), -- client's reported user + host, same as SESSION_USER(), SYSTEM_USER() + CURRENT_USER(), -- authenticated user name + host name - this is the one you want for debugging your mysql.user table configuration + DATABASE(), -- SCHEMA() + NOW(), + CURDATE(), + CURTIME(), + UTC_DATE(), + UTC_TIME(), + UTC_TIMESTAMP(), + SYSDATE(), -- returns date of function completion + -- PS_CURRENT_THREAD_ID(), -- MySQL 8.0.16+ + UUID_SHORT(), -- integer + UUID() -- alnum ; From fad3c15ad9ae1360f00ba4419300aa42b62dc1a8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:35 +0300 Subject: [PATCH 213/402] updated mysql_memory_by_host.sql --- mysql_memory_by_host.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql_memory_by_host.sql b/mysql_memory_by_host.sql index a9cd1de..0f46814 100644 --- a/mysql_memory_by_host.sql +++ b/mysql_memory_by_host.sql @@ -23,10 +23,10 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.memory_by_host_by_current_bytes + sys.memory_by_host_by_current_bytes WHERE - host <> 'background' + host <> 'background' ORDER BY - total_allocated DESC; + total_allocated DESC; From 7b1a1ec527294b1d48b119a1f1598d73b5bd15c9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:39 +0300 Subject: [PATCH 214/402] updated mysql_memory_by_user.sql --- mysql_memory_by_user.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql_memory_by_user.sql b/mysql_memory_by_user.sql index 5e80532..998bc60 100644 --- a/mysql_memory_by_user.sql +++ b/mysql_memory_by_user.sql @@ -23,10 +23,10 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.memory_by_user_by_current_bytes + sys.memory_by_user_by_current_bytes WHERE - user <> 'background' + user <> 'background' ORDER BY - total_allocated DESC; + total_allocated DESC; From e3b08d3ad07bf90ce80b5f235c58db6c0042c83d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:41 +0300 Subject: [PATCH 215/402] updated mysql_sessions.sql --- mysql_sessions.sql | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/mysql_sessions.sql b/mysql_sessions.sql index 4904f4d..64cfaeb 100644 --- a/mysql_sessions.sql +++ b/mysql_sessions.sql @@ -23,31 +23,31 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - user, - db, - program_name, - command, - state, - time, - current_statement, - current_memory, - progress, - lock_latency, - rows_examined, - rows_sent, - rows_affected, - tmp_tables, - tmp_disk_tables, - full_scan, - last_statement, - last_statement_latency, - last_wait, - last_wait_latency, - trx_latency, - trx_state + user, + db, + program_name, + command, + state, + time, + current_statement, + current_memory, + progress, + lock_latency, + rows_examined, + rows_sent, + rows_affected, + tmp_tables, + tmp_disk_tables, + full_scan, + last_statement, + last_statement_latency, + last_wait, + last_wait_latency, + trx_latency, + trx_state FROM - sys.session + sys.session WHERE - user <> 'sql/event_scheduler' + user <> 'sql/event_scheduler' ORDER BY - current_memory DESC; + current_memory DESC; From 755a183071794e373a48e055126235e7ed185bde Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:44 +0300 Subject: [PATCH 216/402] updated mysql_statement_latency_by_host.sql --- mysql_statement_latency_by_host.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql_statement_latency_by_host.sql b/mysql_statement_latency_by_host.sql index 2a7b90c..38e2d72 100644 --- a/mysql_statement_latency_by_host.sql +++ b/mysql_statement_latency_by_host.sql @@ -23,8 +23,8 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.host_summary_by_statement_latency + sys.host_summary_by_statement_latency ORDER BY - total_latency DESC; + total_latency DESC; From 8b3c3516982c0c08f6ff1ef7be67f23cbcc237c9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:46 +0300 Subject: [PATCH 217/402] updated mysql_statement_latency_by_user.sql --- mysql_statement_latency_by_user.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql_statement_latency_by_user.sql b/mysql_statement_latency_by_user.sql index d7988f2..202d68d 100644 --- a/mysql_statement_latency_by_user.sql +++ b/mysql_statement_latency_by_user.sql @@ -23,8 +23,8 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.user_summary_by_statement_latency + sys.user_summary_by_statement_latency ORDER BY - total_latency DESC; + total_latency DESC; From 7ed52352a63854978d6bb226ba7ddcb62a507d9e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:49 +0300 Subject: [PATCH 218/402] updated mysql_tables.sql --- mysql_tables.sql | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql_tables.sql b/mysql_tables.sql index a8c2182..09cb209 100644 --- a/mysql_tables.sql +++ b/mysql_tables.sql @@ -18,24 +18,24 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - table_schema, - table_name, - table_type, - engine, - table_rows, - avg_row_length, - data_length, - max_data_length, - index_length, - data_free, - auto_increment, - create_time, - update_time, - table_comment + table_schema, + table_name, + table_type, + engine, + table_rows, + avg_row_length, + data_length, + max_data_length, + index_length, + data_free, + auto_increment, + create_time, + update_time, + table_comment FROM - information_schema.tables + information_schema.tables WHERE - table_type NOT LIKE '%VIEW%' + table_type NOT LIKE '%VIEW%' ORDER BY - table_schema, - table_name; + table_schema, + table_name; From 8de1797523a9548ef6709644e65ec7556c1ad0f1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:41:59 +0300 Subject: [PATCH 219/402] updated mysql_tables_nonsystem.sql --- mysql_tables_nonsystem.sql | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mysql_tables_nonsystem.sql b/mysql_tables_nonsystem.sql index 338db33..217db7d 100644 --- a/mysql_tables_nonsystem.sql +++ b/mysql_tables_nonsystem.sql @@ -18,26 +18,26 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - table_schema, - table_name, - table_type, - engine, - table_rows, - avg_row_length, - data_length, - max_data_length, - index_length, - data_free, - auto_increment, - create_time, - update_time, - table_comment + table_schema, + table_name, + table_type, + engine, + table_rows, + avg_row_length, + data_length, + max_data_length, + index_length, + data_free, + auto_increment, + create_time, + update_time, + table_comment FROM - information_schema.tables + information_schema.tables WHERE - table_type NOT LIKE '%VIEW%' - AND - table_schema NOT IN ('mysql', 'sys', 'information_schema', 'performance_schema') + table_type NOT LIKE '%VIEW%' + AND + table_schema NOT IN ('mysql', 'sys', 'information_schema', 'performance_schema') ORDER BY - table_schema, - table_name; + table_schema, + table_name; From c9fc8f9eac9b70d1acf53ef23e1dc5143c95ecd7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:03 +0300 Subject: [PATCH 220/402] updated mysql_user.sql --- mysql_user.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql_user.sql b/mysql_user.sql index 2f2109f..2cda08f 100644 --- a/mysql_user.sql +++ b/mysql_user.sql @@ -22,6 +22,6 @@ -- https://dev.mysql.com/doc/refman/8.0/en/sql-function-reference.html SELECT - USER() AS 'Your Requested USER()', -- client's reported user + host, same as SESSION_USER(), SYSTEM_USER() - CURRENT_USER() AS 'Your Actual CURRENT_USER()' -- authenticated user name + host name - this is the one you want for debugging your mysql.user table configuration + USER() AS 'Your Requested USER()', -- client's reported user + host, same as SESSION_USER(), SYSTEM_USER() + CURRENT_USER() AS 'Your Actual CURRENT_USER()' -- authenticated user name + host name - this is the one you want for debugging your mysql.user table configuration ; From d833585b4a407f4958f4920b6f30156e1e269469 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:07 +0300 Subject: [PATCH 221/402] updated mysql_user_summary.sql --- mysql_user_summary.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql_user_summary.sql b/mysql_user_summary.sql index 30b50d5..f2f197e 100644 --- a/mysql_user_summary.sql +++ b/mysql_user_summary.sql @@ -23,8 +23,8 @@ -- sys doesn't exist in MySQL <= 5.6 or MariaDB 10.5 SELECT - * + * FROM - sys.user_summary + sys.user_summary ORDER BY - statement_latency DESC; + statement_latency DESC; From 0e717c81f275979497f8dbb0f6d4ae2414245331 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:10 +0300 Subject: [PATCH 222/402] updated mysql_users.sql --- mysql_users.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mysql_users.sql b/mysql_users.sql index 5268650..078f206 100644 --- a/mysql_users.sql +++ b/mysql_users.sql @@ -23,18 +23,18 @@ -- some fields don't exist on MySQL < 8.0 and MariaDB 10.0 - 10.5, must use mysql_users_pre8.sql instead SELECT - host, - user, - max_connections, - max_user_connections, - password_expired, - password_last_changed, - password_lifetime, - account_locked, - password_reuse_time, - password_require_current + host, + user, + max_connections, + max_user_connections, + password_expired, + password_last_changed, + password_lifetime, + account_locked, + password_reuse_time, + password_require_current FROM - mysql.user + mysql.user ORDER BY - host, - user; + host, + user; From 38464542c9b29cfe3952b161e556328a1752864c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:13 +0300 Subject: [PATCH 223/402] updated mysql_users_pre56.sql --- mysql_users_pre56.sql | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mysql_users_pre56.sql b/mysql_users_pre56.sql index a692777..937b085 100644 --- a/mysql_users_pre56.sql +++ b/mysql_users_pre56.sql @@ -18,20 +18,20 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - host, - user, - max_connections, - max_user_connections - -- this field doesn't exist in MySQL < 5.6 - -- password_expired - -- these fields don't exist in MySQL < 8.0 / MariaDB 10.5 - -- password_last_changed, - -- password_lifetime, - -- account_locked, - -- password_reuse_time, - -- password_require_current + host, + user, + max_connections, + max_user_connections + -- this field doesn't exist in MySQL < 5.6 + -- password_expired + -- these fields don't exist in MySQL < 8.0 / MariaDB 10.5 + -- password_last_changed, + -- password_lifetime, + -- account_locked, + -- password_reuse_time, + -- password_require_current FROM - mysql.user + mysql.user ORDER BY - host, - user; + host, + user; From ab1ebb6b03e55eb24d26069a52237b61882cc9e5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:15 +0300 Subject: [PATCH 224/402] updated mysql_users_pre8.sql --- mysql_users_pre8.sql | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mysql_users_pre8.sql b/mysql_users_pre8.sql index cd07125..aad0005 100644 --- a/mysql_users_pre8.sql +++ b/mysql_users_pre8.sql @@ -21,20 +21,20 @@ -- Tested on MySQL 5.6, 5.7, 8.0 and MariaDB 10.0 - 10.5 SELECT - host, - user, - max_connections, - max_user_connections, - -- not available on MySQL 5.5 - password_expired - -- these fields don't exist in MySQL < 8.0 / MariaDB 10 - -- password_last_changed, - -- password_lifetime, - -- account_locked, - -- password_reuse_time, - -- password_require_current + host, + user, + max_connections, + max_user_connections, + -- not available on MySQL 5.5 + password_expired + -- these fields don't exist in MySQL < 8.0 / MariaDB 10 + -- password_last_changed, + -- password_lifetime, + -- account_locked, + -- password_reuse_time, + -- password_require_current FROM - mysql.user + mysql.user ORDER BY - host, - user; + host, + user; From dc0547ed98353dd49c757072eeb4195c634fd140 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:17 +0300 Subject: [PATCH 225/402] updated mysql_views.sql --- mysql_views.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mysql_views.sql b/mysql_views.sql index 5eb7926..6c838ba 100644 --- a/mysql_views.sql +++ b/mysql_views.sql @@ -18,14 +18,14 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - -- table_catalog, - table_schema, - table_name, - IS_UPDATABLE, - DEFINER, - SECURITY_TYPE + -- table_catalog, + table_schema, + table_name, + IS_UPDATABLE, + DEFINER, + SECURITY_TYPE FROM - information_schema.views + information_schema.views ORDER BY - table_schema, - table_name; + table_schema, + table_name; From 24b136a4773d2fdfa3bcb298bd7f7a8f28df40b8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:42:21 +0300 Subject: [PATCH 226/402] updated mysql_views_system.sql --- mysql_views_system.sql | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql_views_system.sql b/mysql_views_system.sql index c590915..18c2530 100644 --- a/mysql_views_system.sql +++ b/mysql_views_system.sql @@ -18,24 +18,24 @@ -- Tested on MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 5.5, 10.0 - 10.5 SELECT - table_schema, - table_name, - table_type, - engine, - table_rows, - avg_row_length, - data_length, - max_data_length, - index_length, - data_free, - auto_increment, - create_time, - update_time, - table_comment + table_schema, + table_name, + table_type, + engine, + table_rows, + avg_row_length, + data_length, + max_data_length, + index_length, + data_free, + auto_increment, + create_time, + update_time, + table_comment FROM - information_schema.tables + information_schema.tables WHERE - table_type = 'SYSTEM VIEW' + table_type = 'SYSTEM VIEW' ORDER BY - table_schema, - table_name; + table_schema, + table_name; From c3801858108676172a60377cd4b05d9937acbd6f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:43:08 +0300 Subject: [PATCH 227/402] updated postgres_backends_per_database.sql --- postgres_backends_per_database.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/postgres_backends_per_database.sql b/postgres_backends_per_database.sql index 8b6acc3..9e61e64 100644 --- a/postgres_backends_per_database.sql +++ b/postgres_backends_per_database.sql @@ -18,10 +18,10 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - datname, - numbackends + datname, + numbackends FROM - pg_catalog.pg_stat_database + pg_catalog.pg_stat_database ORDER BY - numbackends DESC, - datname ASC; + numbackends DESC, + datname ASC; From c54208fcb2ed414e16906ce51fc7de5a8dfca03d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:43:10 +0300 Subject: [PATCH 228/402] updated postgres_blocked_queries.sql --- postgres_blocked_queries.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/postgres_blocked_queries.sql b/postgres_blocked_queries.sql index 21e115f..741f5ac 100644 --- a/postgres_blocked_queries.sql +++ b/postgres_blocked_queries.sql @@ -20,11 +20,11 @@ -- Tested on PostgreSQL 9.6+, 10.x 11.x, 12.x, 13.0 SELECT - pid, - usename, - pg_blocking_pids(pid) AS blocked_by_pids, - query AS blocked_query + pid, + usename, + pg_blocking_pids(pid) AS blocked_by_pids, + query AS blocked_query FROM - pg_stat_activity + pg_stat_activity WHERE - cardinality(pg_blocking_pids(pid)) > 0; + cardinality(pg_blocking_pids(pid)) > 0; From 746212f51b16b4c02c969db16c78b903dde509eb Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:43:32 +0300 Subject: [PATCH 229/402] updated postgres_columns_null.sql --- postgres_columns_null.sql | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/postgres_columns_null.sql b/postgres_columns_null.sql index 472ee0d..d531231 100644 --- a/postgres_columns_null.sql +++ b/postgres_columns_null.sql @@ -19,44 +19,44 @@ SELECT - nspname, - relname, - attname, - typname, - (stanullfrac*100)::int AS null_percent + nspname, + relname, + attname, + typname, + (stanullfrac*100)::int AS null_percent FROM - pg_class c + pg_class c JOIN - pg_namespace ns + pg_namespace ns ON - (ns.oid=relnamespace) + (ns.oid=relnamespace) JOIN - pg_attribute + pg_attribute ON - (c.oid=attrelid) + (c.oid=attrelid) JOIN - pg_type t + pg_type t ON - (t.oid=atttypid) + (t.oid=atttypid) JOIN - pg_statistic + pg_statistic ON - (c.oid=starelid AND staattnum=attnum) + (c.oid=starelid AND staattnum=attnum) WHERE - (stanullfrac*100)::int = 100 - AND - nspname NOT LIKE E'pg\\_%' - AND - nspname != 'information_schema' - AND - relkind = 'r' - AND - NOT attisdropped - AND - attstattarget != 0 - -- AND - --reltuples >= 100 + (stanullfrac*100)::int = 100 + AND + nspname NOT LIKE E'pg\\_%' + AND + nspname != 'information_schema' + AND + relkind = 'r' + AND + NOT attisdropped + AND + attstattarget != 0 + -- AND + --reltuples >= 100 ORDER BY - nspname, - relname, - attname; + nspname, + relname, + attname; From b41758ca5bf62a1cce8e2a3bc18820cf443d115d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:20 +0300 Subject: [PATCH 230/402] updated postgres_columns_useless.sql --- postgres_columns_useless.sql | 84 ++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/postgres_columns_useless.sql b/postgres_columns_useless.sql index 24c7bd0..a434bfa 100644 --- a/postgres_columns_useless.sql +++ b/postgres_columns_useless.sql @@ -23,56 +23,56 @@ SELECT - nspname, - relname, - attname, - typname, - (stanullfrac*100)::int AS null_percent, - case - when stadistinct >= 0 - then stadistinct - else - abs(stadistinct)*reltuples - end AS "distinct", - case 1 - when stakind1 - then stavalues1 - when stakind2 - then stavalues2 - end AS "values" + nspname, + relname, + attname, + typname, + (stanullfrac*100)::int AS null_percent, + case + when stadistinct >= 0 + then stadistinct + else + abs(stadistinct)*reltuples + end AS "distinct", + case 1 + when stakind1 + then stavalues1 + when stakind2 + then stavalues2 + end AS "values" FROM - pg_class c + pg_class c JOIN - pg_namespace ns + pg_namespace ns ON - (ns.oid=relnamespace) + (ns.oid=relnamespace) JOIN - pg_attribute + pg_attribute ON - (c.oid=attrelid) + (c.oid=attrelid) JOIN - pg_type t + pg_type t ON - (t.oid=atttypid) + (t.oid=atttypid) JOIN - pg_statistic + pg_statistic ON - (c.oid=starelid AND staattnum=attnum) + (c.oid=starelid AND staattnum=attnum) WHERE - nspname NOT LIKE E'pg\\_%' - AND - nspname != 'information_schema' - AND - relkind = 'r' - AND - NOT attisdropped - AND - attstattarget != 0 - AND - reltuples >= 100 - AND - stadistinct BETWEEN 0 AND 1 + nspname NOT LIKE E'pg\\_%' + AND + nspname != 'information_schema' + AND + relkind = 'r' + AND + NOT attisdropped + AND + attstattarget != 0 + AND + reltuples >= 100 + AND + stadistinct BETWEEN 0 AND 1 ORDER BY - nspname, - relname, - attname; + nspname, + relname, + attname; From a65755de8058873cd8d3153b5df9d5ded407a189 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:25 +0300 Subject: [PATCH 231/402] updated postgres_databases_by_size.sql --- postgres_databases_by_size.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/postgres_databases_by_size.sql b/postgres_databases_by_size.sql index 8bc87e8..cfe8e9d 100644 --- a/postgres_databases_by_size.sql +++ b/postgres_databases_by_size.sql @@ -18,9 +18,9 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - datname, - pg_size_pretty(pg_database_size(datname)) + datname, + pg_size_pretty(pg_database_size(datname)) FROM - pg_database + pg_database ORDER - BY pg_database_size(datname) DESC; + BY pg_database_size(datname) DESC; From 9eb66a3c070ce4f57a5fcbab520906dd8e8f17ee Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:35 +0300 Subject: [PATCH 232/402] updated postgres_databases_by_size_if_accessible.sql --- postgres_databases_by_size_if_accessible.sql | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/postgres_databases_by_size_if_accessible.sql b/postgres_databases_by_size_if_accessible.sql index 73eb057..b17dfb5 100644 --- a/postgres_databases_by_size_if_accessible.sql +++ b/postgres_databases_by_size_if_accessible.sql @@ -18,17 +18,17 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - d.datname AS Name, - pg_catalog.pg_get_userbyid(d.datdba) AS Owner, - CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') - THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname)) - ELSE 'No Access' - END AS SIZE + d.datname AS Name, + pg_catalog.pg_get_userbyid(d.datdba) AS Owner, + CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') + THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname)) + ELSE 'No Access' + END AS SIZE FROM - pg_catalog.pg_database d + pg_catalog.pg_database d ORDER BY - CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') - THEN pg_catalog.pg_database_size(d.datname) - ELSE NULL - END - DESC; + CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') + THEN pg_catalog.pg_database_size(d.datname) + ELSE NULL + END + DESC; From 3d5ea06866fd96e138022ffaf509c3f1ee7b536f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:39 +0300 Subject: [PATCH 233/402] updated postgres_dirs.sql --- postgres_dirs.sql | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_dirs.sql b/postgres_dirs.sql index 4fb12a3..76caa12 100644 --- a/postgres_dirs.sql +++ b/postgres_dirs.sql @@ -20,28 +20,28 @@ -- Tested on PostgreSQL 11.9, 12.x, 13.0 SELECT - current_setting('config_file') AS "config_file", - current_setting('hba_file') AS "hba_file", - current_setting('ident_file') AS "ident_file"; + current_setting('config_file') AS "config_file", + current_setting('hba_file') AS "hba_file", + current_setting('ident_file') AS "ident_file"; SELECT - current_setting('data_directory') AS "data_directory", - current_setting('external_pid_file') AS "external_pid_file"; + current_setting('data_directory') AS "data_directory", + current_setting('external_pid_file') AS "external_pid_file"; SELECT - current_setting('unix_socket_directories') AS "unix_socket_directories", - current_setting('unix_socket_permissions') AS "unix_socket_permissions", - current_setting('unix_socket_group') AS "unix_socket_group"; + current_setting('unix_socket_directories') AS "unix_socket_directories", + current_setting('unix_socket_permissions') AS "unix_socket_permissions", + current_setting('unix_socket_group') AS "unix_socket_group"; SELECT - -- not available on PostgreSQL < 10 - pg_current_logfile(), - current_setting('log_directory') AS "log_directory", -- log - current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log + -- not available on PostgreSQL < 10 + pg_current_logfile(), + current_setting('log_directory') AS "log_directory", -- log + current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log SELECT - -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, - pg_ls_waldir(), - -- not available on PostgreSQL <= 11.8 - pg_ls_archive_statusdir(), - pg_ls_tmpdir(); + -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, + pg_ls_waldir(), + -- not available on PostgreSQL <= 11.8 + pg_ls_archive_statusdir(), + pg_ls_tmpdir(); From 1434ac7cb7d810fd0d07e1a2a9300ebf5f1c707d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:42 +0300 Subject: [PATCH 234/402] updated postgres_dirs_pre10.sql --- postgres_dirs_pre10.sql | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/postgres_dirs_pre10.sql b/postgres_dirs_pre10.sql index f2a69d8..8d359a0 100644 --- a/postgres_dirs_pre10.sql +++ b/postgres_dirs_pre10.sql @@ -20,31 +20,31 @@ -- Tested on PostgreSQL 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - current_setting('config_file') AS "config_file", - current_setting('hba_file') AS "hba_file", - current_setting('ident_file') AS "ident_file"; + current_setting('config_file') AS "config_file", + current_setting('hba_file') AS "hba_file", + current_setting('ident_file') AS "ident_file"; SELECT - current_setting('data_directory') AS "data_directory", - current_setting('external_pid_file') AS "external_pid_file"; + current_setting('data_directory') AS "data_directory", + current_setting('external_pid_file') AS "external_pid_file"; SELECT -- not available on PostgreSQL < 9.3 - --current_setting('unix_socket_directories') AS "unix_socket_directories", - current_setting('unix_socket_permissions') AS "unix_socket_permissions", - current_setting('unix_socket_group') AS "unix_socket_group"; + --current_setting('unix_socket_directories') AS "unix_socket_directories", + current_setting('unix_socket_permissions') AS "unix_socket_permissions", + current_setting('unix_socket_group') AS "unix_socket_group"; SELECT - -- not available on PostgreSQL < 10 - --pg_current_logfile(), - current_setting('log_directory') AS "log_directory", -- log - current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log + -- not available on PostgreSQL < 10 + --pg_current_logfile(), + current_setting('log_directory') AS "log_directory", -- log + current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log --SELECT - -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, - -- not available on PostgreSQL < 10 - --pg_ls_waldir() - -- not available on PostgreSQL <= 11.8 - --pg_ls_archive_statusdir(), - --pg_ls_tmpdir(); + -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, + -- not available on PostgreSQL < 10 + --pg_ls_waldir() + -- not available on PostgreSQL <= 11.8 + --pg_ls_archive_statusdir(), + --pg_ls_tmpdir(); ; From f09011f2b30b0db9dd459ccc6812aac5acb78278 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:44:45 +0300 Subject: [PATCH 235/402] updated postgres_dirs_pre11.9.sql --- postgres_dirs_pre11.9.sql | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_dirs_pre11.9.sql b/postgres_dirs_pre11.9.sql index d589061..7119a91 100644 --- a/postgres_dirs_pre11.9.sql +++ b/postgres_dirs_pre11.9.sql @@ -20,29 +20,29 @@ -- Tested on PostgreSQL 10.x, 11.x, 12.x, 13.0 SELECT - current_setting('config_file') AS "config_file", - current_setting('hba_file') AS "hba_file", - current_setting('ident_file') AS "ident_file"; + current_setting('config_file') AS "config_file", + current_setting('hba_file') AS "hba_file", + current_setting('ident_file') AS "ident_file"; SELECT - current_setting('data_directory') AS "data_directory", - current_setting('external_pid_file') AS "external_pid_file"; + current_setting('data_directory') AS "data_directory", + current_setting('external_pid_file') AS "external_pid_file"; SELECT - current_setting('unix_socket_directories') AS "unix_socket_directories", - current_setting('unix_socket_permissions') AS "unix_socket_permissions", - current_setting('unix_socket_group') AS "unix_socket_group"; + current_setting('unix_socket_directories') AS "unix_socket_directories", + current_setting('unix_socket_permissions') AS "unix_socket_permissions", + current_setting('unix_socket_group') AS "unix_socket_group"; SELECT - -- not available on PostgreSQL < 10 - pg_current_logfile(), - current_setting('log_directory') AS "log_directory", -- log - current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log + -- not available on PostgreSQL < 10 + pg_current_logfile(), + current_setting('log_directory') AS "log_directory", -- log + current_setting('log_filename') AS "log_filename"; -- postgresql-%Y-%m-%d_%H%M%S.log SELECT - -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, - pg_ls_waldir() - -- not available on PostgreSQL <= 11.8 - --pg_ls_archive_statusdir(), - --pg_ls_tmpdir(); + -- CASE WHEN pg_current_logfile() IS NOT NULL THEN pg_ls_logdir() END AS pg_ls_logdir, + pg_ls_waldir() + -- not available on PostgreSQL <= 11.8 + --pg_ls_archive_statusdir(), + --pg_ls_tmpdir(); ; From 2b8f367f32f3b6b462fe46af06e329347e5935e8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:45:00 +0300 Subject: [PATCH 236/402] updated postgres_idle_sessions.sql --- postgres_idle_sessions.sql | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/postgres_idle_sessions.sql b/postgres_idle_sessions.sql index c3e06a1..66c1975 100644 --- a/postgres_idle_sessions.sql +++ b/postgres_idle_sessions.sql @@ -24,30 +24,30 @@ -- Tested on PostgreSQL 9.2, 10.x, 11.x, 12.x, 13.0 SELECT - rank() over (partition by client_addr order by backend_start ASC) as rank, - pid, - backend_start, - query_start, - state_change, - datname, - usename, - client_addr + rank() over (partition by client_addr order by backend_start ASC) as rank, + pid, + backend_start, + query_start, + state_change, + datname, + usename, + client_addr FROM - pg_stat_activity + pg_stat_activity WHERE - -- don't kill yourself - pid <> pg_backend_pid() - -- AND - -- don't kill your admin tools - --application_name !~ '(?:psql)|(?:pgAdmin.+)' - -- AND - --usename not in ('postgres') - AND - query in ('') - AND - ( - (current_timestamp - query_start) > interval '10 minutes' - OR - (query_start IS NULL AND (current_timestamp - backend_start) > interval '10 minutes') - ) + -- don't kill yourself + pid <> pg_backend_pid() + -- AND + -- don't kill your admin tools + --application_name !~ '(?:psql)|(?:pgAdmin.+)' + -- AND + --usename not in ('postgres') + AND + query in ('') + AND + ( + (current_timestamp - query_start) > interval '10 minutes' + OR + (query_start IS NULL AND (current_timestamp - backend_start) > interval '10 minutes') + ) ; From ba1d84bbace74da9818a895dea0c9339ffd9968a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:45:13 +0300 Subject: [PATCH 237/402] updated postgres_idle_sessions_current_db_kill.sql --- postgres_idle_sessions_current_db_kill.sql | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/postgres_idle_sessions_current_db_kill.sql b/postgres_idle_sessions_current_db_kill.sql index 9ce58f4..f7e7687 100644 --- a/postgres_idle_sessions_current_db_kill.sql +++ b/postgres_idle_sessions_current_db_kill.sql @@ -20,28 +20,28 @@ -- Tested on PostgreSQL 9.2+, 10.x, 11.x, 12.x, 13.0 SELECT - pg_terminate_backend(pid) + pg_terminate_backend(pid) FROM - pg_stat_activity + pg_stat_activity WHERE - -- don't kill yourself - pid <> pg_backend_pid() - -- AND - -- don't kill your admin tools - --application_name !~ '(?:psql)|(?:pgAdmin.+)' - -- AND - --usename not in ('postgres') - AND - datname = current_database() - AND - query in ('') - AND - state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') - AND - --state_change < current_timestamp - INTERVAL '15' MINUTE; - ( - (current_timestamp - query_start) > interval '15 minutes' - OR - (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') - ) + -- don't kill yourself + pid <> pg_backend_pid() + -- AND + -- don't kill your admin tools + --application_name !~ '(?:psql)|(?:pgAdmin.+)' + -- AND + --usename not in ('postgres') + AND + datname = current_database() + AND + query in ('') + AND + state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') + AND + --state_change < current_timestamp - INTERVAL '15' MINUTE; + ( + (current_timestamp - query_start) > interval '15 minutes' + OR + (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') + ) ; From 4b0722cb46f19f4e428acfc4be17c006d5131552 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:45:26 +0300 Subject: [PATCH 238/402] updated postgres_idle_sessions_current_db_kill_pre92.sql --- ...es_idle_sessions_current_db_kill_pre92.sql | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/postgres_idle_sessions_current_db_kill_pre92.sql b/postgres_idle_sessions_current_db_kill_pre92.sql index 17cb8f6..3f9586e 100644 --- a/postgres_idle_sessions_current_db_kill_pre92.sql +++ b/postgres_idle_sessions_current_db_kill_pre92.sql @@ -20,29 +20,29 @@ -- Tested on PostgreSQL 8.4, 9.0, 9.1 SELECT - pg_terminate_backend(procpid) + pg_terminate_backend(procpid) FROM - pg_stat_activity + pg_stat_activity WHERE - -- don't kill yourself - procpid <> pg_backend_pid() - -- AND - -- don't kill your admin tools - --application_name !~ '(?:psql)|(?:pgAdmin.+)' - -- AND - --usename not in ('postgres') - AND - datname = current_database() - AND - current_query in ('') - AND - waiting - --state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') - AND - --state_change < current_timestamp - INTERVAL '15' MINUTE; - ( - (current_timestamp - query_start) > interval '15 minutes' - OR - (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') - ) + -- don't kill yourself + procpid <> pg_backend_pid() + -- AND + -- don't kill your admin tools + --application_name !~ '(?:psql)|(?:pgAdmin.+)' + -- AND + --usename not in ('postgres') + AND + datname = current_database() + AND + current_query in ('') + AND + waiting + --state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') + AND + --state_change < current_timestamp - INTERVAL '15' MINUTE; + ( + (current_timestamp - query_start) > interval '15 minutes' + OR + (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') + ) ; From 60e4bd680fce6bf771bb838431a99a1924b0af10 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:45:36 +0300 Subject: [PATCH 239/402] updated postgres_idle_sessions_kill.sql --- postgres_idle_sessions_kill.sql | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/postgres_idle_sessions_kill.sql b/postgres_idle_sessions_kill.sql index 373a473..b0c92d9 100644 --- a/postgres_idle_sessions_kill.sql +++ b/postgres_idle_sessions_kill.sql @@ -20,26 +20,26 @@ -- Tested on PostgreSQL 9.2+, 10.x, 11.x, 12.x, 13.0 SELECT - pg_terminate_backend(pid) + pg_terminate_backend(pid) FROM - pg_stat_activity + pg_stat_activity WHERE - -- don't kill yourself - pid <> pg_backend_pid() - -- AND - -- don't kill your admin tools - --application_name !~ '(?:psql)|(?:pgAdmin.+)' - -- AND - --usename not in ('postgres') - AND - query in ('') - AND - state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') - AND - --state_change < current_timestamp - INTERVAL '15' MINUTE; - ( - (current_timestamp - query_start) > interval '15 minutes' - OR - (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') - ) + -- don't kill yourself + pid <> pg_backend_pid() + -- AND + -- don't kill your admin tools + --application_name !~ '(?:psql)|(?:pgAdmin.+)' + -- AND + --usename not in ('postgres') + AND + query in ('') + AND + state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled') + AND + --state_change < current_timestamp - INTERVAL '15' MINUTE; + ( + (current_timestamp - query_start) > interval '15 minutes' + OR + (query_start IS NULL AND (current_timestamp - backend_start) > interval '15 minutes') + ) ; From 1f36eda42e070c9f702215f053d96ed51ade6ef8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:45:44 +0300 Subject: [PATCH 240/402] updated postgres_idle_sessions_pre92.sql --- postgres_idle_sessions_pre92.sql | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/postgres_idle_sessions_pre92.sql b/postgres_idle_sessions_pre92.sql index d9bb9c8..872dcf3 100644 --- a/postgres_idle_sessions_pre92.sql +++ b/postgres_idle_sessions_pre92.sql @@ -24,30 +24,30 @@ -- Tested on PostgreSQL 8.4, 9.0, 9.1 SELECT - rank() over (partition by client_addr order by backend_start ASC) as rank, - procpid, - backend_start, - query_start, - waiting, - datname, - usename, - client_addr + rank() over (partition by client_addr order by backend_start ASC) as rank, + procpid, + backend_start, + query_start, + waiting, + datname, + usename, + client_addr FROM - pg_stat_activity + pg_stat_activity WHERE - -- don't kill yourself - procpid <> pg_backend_pid() - -- AND - -- don't kill your admin tools - --application_name !~ '(?:psql)|(?:pgAdmin.+)' - -- AND - --usename not in ('postgres') - AND - current_query in ('') - AND - ( - (current_timestamp - query_start) > interval '10 minutes' - OR - (query_start IS NULL AND (current_timestamp - backend_start) > interval '10 minutes') - ) + -- don't kill yourself + procpid <> pg_backend_pid() + -- AND + -- don't kill your admin tools + --application_name !~ '(?:psql)|(?:pgAdmin.+)' + -- AND + --usename not in ('postgres') + AND + current_query in ('') + AND + ( + (current_timestamp - query_start) > interval '10 minutes' + OR + (query_start IS NULL AND (current_timestamp - backend_start) > interval '10 minutes') + ) ; From 752ba82dad30fee9b15f7ae8fbc40d6f4c2978b6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:46:00 +0300 Subject: [PATCH 241/402] updated postgres_index_cardinality.sql --- postgres_index_cardinality.sql | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/postgres_index_cardinality.sql b/postgres_index_cardinality.sql index 735555b..9cb0867 100644 --- a/postgres_index_cardinality.sql +++ b/postgres_index_cardinality.sql @@ -18,17 +18,17 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - relname, - --relkind, - reltuples AS "cardinality (reltuples)", - relpages + relname, + --relkind, + reltuples AS "cardinality (reltuples)", + relpages FROM - pg_class + pg_class WHERE - relkind = 'i' --- AND --- relname LIKE 'someprefix%'; - AND - relname NOT ILIKE 'pg_%' + relkind = 'i' + -- AND + --relname LIKE 'someprefix%'; + AND + relname NOT ILIKE 'pg_%' ORDER BY - 2 DESC; + 2 DESC; From e1ddebde1bd5ed16ac8a12e8bb86a494725913c9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:46:18 +0300 Subject: [PATCH 242/402] updated postgres_index_cardinality_with_schema_name.sql --- ...res_index_cardinality_with_schema_name.sql | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/postgres_index_cardinality_with_schema_name.sql b/postgres_index_cardinality_with_schema_name.sql index cf98912..b5c3855 100644 --- a/postgres_index_cardinality_with_schema_name.sql +++ b/postgres_index_cardinality_with_schema_name.sql @@ -18,32 +18,32 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x 11.x, 12.x, 13.0 SELECT - schema_name, - relname, - reltuples AS "cardinality (reltuples)", - relpages -FROM ( - SELECT - pg_catalog.pg_namespace.nspname AS schema_name, + schema_name, relname, - reltuples, + reltuples AS "cardinality (reltuples)", relpages - FROM - pg_class - JOIN - pg_namespace ON relnamespace = pg_namespace.oid - WHERE - relkind = 'i' +FROM ( + SELECT + pg_catalog.pg_namespace.nspname AS schema_name, + relname, + reltuples, + relpages + FROM + pg_class + JOIN + pg_namespace ON relnamespace = pg_namespace.oid + WHERE + relkind = 'i' ) t WHERE - schema_name NOT ILIKE 'pg_%' - AND - schema_name <> 'information_schema' + schema_name NOT ILIKE 'pg_%' + AND + schema_name <> 'information_schema' -- AND -- relname LIKE 'someprefix%'; - AND - relname NOT ILIKE 'pg_%' + AND + relname NOT ILIKE 'pg_%' ORDER BY - 3 DESC, - schema_name, - relname; + 3 DESC, + schema_name, + relname; From 61dab0b9ac4d6f4ab4f195cd3234fc368f606297 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:46:24 +0300 Subject: [PATCH 243/402] updated postgres_indexes_cache_hit_ratio.sql --- postgres_indexes_cache_hit_ratio.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/postgres_indexes_cache_hit_ratio.sql b/postgres_indexes_cache_hit_ratio.sql index e51011f..edcba15 100644 --- a/postgres_indexes_cache_hit_ratio.sql +++ b/postgres_indexes_cache_hit_ratio.sql @@ -20,10 +20,10 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - SUM(idx_blks_read) AS idx_blks_read, - SUM(idx_blks_hit) AS idx_blks_hit, - SUM(idx_blks_hit) / - GREATEST(SUM(idx_blks_hit) + SUM(idx_blks_read), 1)::float - AS ratio + SUM(idx_blks_read) AS idx_blks_read, + SUM(idx_blks_hit) AS idx_blks_hit, + SUM(idx_blks_hit) / + GREATEST(SUM(idx_blks_hit) + SUM(idx_blks_read), 1)::float + AS ratio FROM - pg_statio_user_indexes; + pg_statio_user_indexes; From 87457e33101e2cb8385852a428c04d3bee58d457 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:46:32 +0300 Subject: [PATCH 244/402] updated postgres_indexes_unused.sql --- postgres_indexes_unused.sql | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/postgres_indexes_unused.sql b/postgres_indexes_unused.sql index c4907b0..ab0e7db 100644 --- a/postgres_indexes_unused.sql +++ b/postgres_indexes_unused.sql @@ -18,21 +18,21 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - relname AS table, - indexrelname AS index, - idx_scan, - idx_tup_read, - idx_tup_fetch, - pg_size_pretty(pg_relation_size(indexrelname::regclass)) + relname AS table, + indexrelname AS index, + idx_scan, + idx_tup_read, + idx_tup_fetch, + pg_size_pretty(pg_relation_size(indexrelname::regclass)) FROM - pg_stat_all_indexes + pg_stat_all_indexes WHERE - schemaname = 'public' - AND - idx_scan = 0 - AND - idx_tup_read = 0 - AND - idx_tup_fetch = 0 + schemaname = 'public' + AND + idx_scan = 0 + AND + idx_tup_read = 0 + AND + idx_tup_fetch = 0 ORDER BY - pg_relation_size(indexrelname::regclass) DESC; + pg_relation_size(indexrelname::regclass) DESC; From f071662e62810d4cb367b48f79a197c40413372e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:46:50 +0300 Subject: [PATCH 245/402] updated postgres_info.sql --- postgres_info.sql | 132 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/postgres_info.sql b/postgres_info.sql index 6e4fb3d..34ae61e 100644 --- a/postgres_info.sql +++ b/postgres_info.sql @@ -32,9 +32,9 @@ -- version() returns a long human readable string, hence we split from others SELECTs eg. -- PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit SELECT - version(), - current_setting('server_version') AS "server_version", - current_setting('server_version_num') AS "server_version_num"; + version(), + current_setting('server_version') AS "server_version", + current_setting('server_version_num') AS "server_version_num"; -- ========================================================================== -- -- S e r v e r D e t a i l s @@ -44,18 +44,18 @@ SELECT --\pset title 'PostgreSQL Server Details' SELECT - pg_postmaster_start_time(), - pg_conf_load_time(), - current_setting('logging_collector') AS "logging_collector", - current_setting('log_destination') AS "log_destination", - -- not available in Postgres 9 - -- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this - -- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile - pg_current_logfile() - -- current_setting('log_directory') AS "log_directory", -- log - -- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log - -- not available on Postgres 10 - --pg_jit_available() + pg_postmaster_start_time(), + pg_conf_load_time(), + current_setting('logging_collector') AS "logging_collector", + current_setting('log_destination') AS "log_destination", + -- not available in Postgres 9 + -- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this + -- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile + pg_current_logfile() + -- current_setting('log_directory') AS "log_directory", -- log + -- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log + -- not available on Postgres 10 + --pg_jit_available() ; -- SELECT pg_reload_conf(), pg_rotate_logfile(); @@ -87,18 +87,18 @@ SELECT --\pset title 'Config Files' SELECT - current_setting('config_file') AS "config_file", - current_setting('hba_file') AS "hba_file", - current_setting('ident_file') AS "ident_file"; + current_setting('config_file') AS "config_file", + current_setting('hba_file') AS "hba_file", + current_setting('ident_file') AS "ident_file"; \echo --\pset title 'PostgreSQL Data Directory & Unix Sockets' SELECT - current_setting('data_directory') AS "data_directory", - current_setting('unix_socket_directories') AS "unix_socket_directories", - current_setting('unix_socket_permissions') AS "unix_socket_permissions", - current_setting('unix_socket_group') AS "unix_socket_group"; + current_setting('data_directory') AS "data_directory", + current_setting('unix_socket_directories') AS "unix_socket_directories", + current_setting('unix_socket_permissions') AS "unix_socket_permissions", + current_setting('unix_socket_group') AS "unix_socket_group"; -- ========================================================================== -- -- B u f f e r s & C o n n e c t i o n s @@ -108,13 +108,13 @@ SELECT --\pset title 'Buffers & Connections' SELECT - current_setting('shared_buffers') AS "shared_buffers", - current_setting('work_mem') AS "work_mem", - current_setting('max_connections') AS "max_connections", - current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures - current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts - current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon - current_setting('password_encryption') AS "password_encryption"; + current_setting('shared_buffers') AS "shared_buffers", + current_setting('work_mem') AS "work_mem", + current_setting('max_connections') AS "max_connections", + current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures + current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts + current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon + current_setting('password_encryption') AS "password_encryption"; -- ========================================================================== -- @@ -126,12 +126,12 @@ SELECT -- in SQL the following have special syntax and should be called without parens: current_catalog, current_role, current_schema, current_user, session_user SELECT - current_user, -- aka user, current_role - this is the effective user for permission checking - session_user, -- connection user before superuser SET SESSION AUTHORIZATION - current_schema, - current_catalog, -- SQL standard, same as current_database() - pg_backend_pid(), - current_query(); + current_user, -- aka user, current_role - this is the effective user for permission checking + session_user, -- connection user before superuser SET SESSION AUTHORIZATION + current_schema, + current_catalog, -- SQL standard, same as current_database() + pg_backend_pid(), + current_query(); \echo --\pset title 'Schema search list' @@ -147,16 +147,16 @@ SELECT current_schemas(true) AS "current_schemas(true) - auto-searched schemas"; --\pset title 'Backup & Recovery' SELECT - pg_is_in_backup(), - pg_is_in_recovery(), - pg_backup_start_time(), - 'see postgres_recovery.sql for more info' AS "info"; - -- use postgres_recovery.sql instead of having a big blank table distracting us here - -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql - --( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" + pg_is_in_backup(), + pg_is_in_recovery(), + pg_backup_start_time(), + 'see postgres_recovery.sql for more info' AS "info"; + -- use postgres_recovery.sql instead of having a big blank table distracting us here + -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql + --( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" --SELECT -- pg_ls_logdir(), @@ -173,10 +173,10 @@ SELECT --\pset title 'Networking' SELECT - inet_client_addr(), - inet_client_addr(), - inet_server_addr(), - inet_server_port(); + inet_client_addr(), + inet_client_addr(), + inet_server_addr(), + inet_server_port(); -- causes 0 rows when mixed with other select funcs --SELECT pg_listening_channels(); @@ -193,23 +193,23 @@ SELECT --\pset title 'Date & Time' SELECT - -- current timestamps even inside transactions/functions - now(), - timeofday(), -- human string timestamp with timezone - - -- at start of current transaction for consistency, includes +offset timezone - current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone - current_date, - current_time(1) AS "current_time(1)", -- includes +offset timezone - localtime, - localtimestamp(1) AS "localtimestamp(1)", - - -- provide current timestamps even inside transactions/functions - -- now() - -- timeofday(), -- human string timestamp with timezone - clock_timestamp(), -- current date + time (changes throughout function) - statement_timestamp(), - transaction_timestamp() -- same as CURRENT_TIMESTAMP + -- current timestamps even inside transactions/functions + now(), + timeofday(), -- human string timestamp with timezone + + -- at start of current transaction for consistency, includes +offset timezone + current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone + current_date, + current_time(1) AS "current_time(1)", -- includes +offset timezone + localtime, + localtimestamp(1) AS "localtimestamp(1)", + + -- provide current timestamps even inside transactions/functions + -- now() + -- timeofday(), -- human string timestamp with timezone + clock_timestamp(), -- current date + time (changes throughout function) + statement_timestamp(), + transaction_timestamp() -- same as CURRENT_TIMESTAMP ; --\pset title From 2a8c14dea49f0e700e8704845bf81de54005a243 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:11 +0300 Subject: [PATCH 246/402] updated postgres_info_pre10.sql --- postgres_info_pre10.sql | 138 ++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/postgres_info_pre10.sql b/postgres_info_pre10.sql index 2dfa475..d0ff8a9 100644 --- a/postgres_info_pre10.sql +++ b/postgres_info_pre10.sql @@ -30,9 +30,9 @@ -- version() returns a long human readable string, hence we split from others SELECTs eg. -- PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit SELECT - version(), - current_setting('server_version') AS "server_version", - current_setting('server_version_num') AS "server_version_num"; + version(), + current_setting('server_version') AS "server_version", + current_setting('server_version_num') AS "server_version_num"; -- ========================================================================== -- -- S e r v e r D e t a i l s @@ -42,18 +42,18 @@ SELECT --\pset title 'PostgreSQL Server Details' SELECT - pg_postmaster_start_time(), - pg_conf_load_time(), - current_setting('logging_collector') AS "logging_collector", - current_setting('log_destination') AS "log_destination" - -- not available in Postgres 9 - -- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this - -- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile - --pg_current_logfile() - -- current_setting('log_directory') AS "log_directory", -- log - -- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log - -- not available on Postgres 10 - --pg_jit_available() + pg_postmaster_start_time(), + pg_conf_load_time(), + current_setting('logging_collector') AS "logging_collector", + current_setting('log_destination') AS "log_destination" + -- not available in Postgres 9 + -- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this + -- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile + --pg_current_logfile() + -- current_setting('log_directory') AS "log_directory", -- log + -- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log + -- not available on Postgres 10 + --pg_jit_available() ; -- SELECT pg_reload_conf(), pg_rotate_logfile(); @@ -85,19 +85,19 @@ SELECT --\pset title 'Config Files' SELECT - current_setting('config_file') AS "config_file", - current_setting('hba_file') AS "hba_file", - current_setting('ident_file') AS "ident_file"; + current_setting('config_file') AS "config_file", + current_setting('hba_file') AS "hba_file", + current_setting('ident_file') AS "ident_file"; \echo --\pset title 'PostgreSQL Data Directory & Unix Sockets' SELECT - current_setting('data_directory') AS "data_directory", - -- not available on PostgreSQL <= 9.2 - --current_setting('unix_socket_directories') AS "unix_socket_directories", - current_setting('unix_socket_permissions') AS "unix_socket_permissions", - current_setting('unix_socket_group') AS "unix_socket_group"; + current_setting('data_directory') AS "data_directory", + -- not available on PostgreSQL <= 9.2 + --current_setting('unix_socket_directories') AS "unix_socket_directories", + current_setting('unix_socket_permissions') AS "unix_socket_permissions", + current_setting('unix_socket_group') AS "unix_socket_group"; -- ========================================================================== -- -- B u f f e r s & C o n n e c t i o n s @@ -107,13 +107,13 @@ SELECT --\pset title 'Buffers & Connections' SELECT - current_setting('shared_buffers') AS "shared_buffers", - current_setting('work_mem') AS "work_mem", - current_setting('max_connections') AS "max_connections", - current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures - current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts - current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon - current_setting('password_encryption') AS "password_encryption"; + current_setting('shared_buffers') AS "shared_buffers", + current_setting('work_mem') AS "work_mem", + current_setting('max_connections') AS "max_connections", + current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures + current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts + current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon + current_setting('password_encryption') AS "password_encryption"; -- ========================================================================== -- @@ -125,12 +125,12 @@ SELECT -- in SQL the following have special syntax and should be called without parens: current_catalog, current_role, current_schema, current_user, session_user SELECT - current_user, -- aka user, current_role - this is the effective user for permission checking - session_user, -- connection user before superuser SET SESSION AUTHORIZATION - current_schema, - current_catalog, -- SQL standard, same as current_database() - pg_backend_pid(), - current_query(); + current_user, -- aka user, current_role - this is the effective user for permission checking + session_user, -- connection user before superuser SET SESSION AUTHORIZATION + current_schema, + current_catalog, -- SQL standard, same as current_database() + pg_backend_pid(), + current_query(); \echo --\pset title 'Schema search list' @@ -143,19 +143,19 @@ SELECT current_schemas(true) AS "current_schemas(true) - auto-searched schemas"; -- ========================================================================== -- --SELECT - -- not available on PostgreSQL <= 9.2 - --pg_is_in_backup(), - -- not available on PostgreSQL 8.4 - --pg_is_in_recovery(), - -- not available on PostgreSQL <= 9.2 - -- pg_backup_start_time(), + -- not available on PostgreSQL <= 9.2 + --pg_is_in_backup(), + -- not available on PostgreSQL 8.4 + --pg_is_in_recovery(), + -- not available on PostgreSQL <= 9.2 + -- pg_backup_start_time(), -- 'see postgres_recovery.sql for more info' AS "info"; - -- use postgres_recovery.sql instead of having a big blank table distracting us here - -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql - --( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", - --( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" + -- use postgres_recovery.sql instead of having a big blank table distracting us here + -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql + --( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", + --( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" --SELECT -- pg_ls_logdir(), @@ -175,10 +175,10 @@ SELECT current_schemas(true) AS "current_schemas(true) - auto-searched schemas"; --\pset title 'Networking' SELECT - inet_client_addr(), - inet_client_addr(), - inet_server_addr(), - inet_server_port(); + inet_client_addr(), + inet_client_addr(), + inet_server_addr(), + inet_server_port(); -- causes 0 rows when mixed with other select funcs --SELECT pg_listening_channels(); @@ -195,23 +195,23 @@ SELECT --\pset title 'Date & Time' SELECT - -- current timestamps even inside transactions/functions - now(), - timeofday(), -- human string timestamp with timezone - - -- at start of current transaction for consistency, includes +offset timezone - current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone - current_date, - current_time(1) AS "current_time(1)", -- includes +offset timezone - localtime, - localtimestamp(1) AS "localtimestamp(1)", - - -- provide current timestamps even inside transactions/functions - -- now() - -- timeofday(), -- human string timestamp with timezone - clock_timestamp(), -- current date + time (changes throughout function) - statement_timestamp(), - transaction_timestamp() -- same as CURRENT_TIMESTAMP + -- current timestamps even inside transactions/functions + now(), + timeofday(), -- human string timestamp with timezone + + -- at start of current transaction for consistency, includes +offset timezone + current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone + current_date, + current_time(1) AS "current_time(1)", -- includes +offset timezone + localtime, + localtimestamp(1) AS "localtimestamp(1)", + + -- provide current timestamps even inside transactions/functions + -- now() + -- timeofday(), -- human string timestamp with timezone + clock_timestamp(), -- current date + time (changes throughout function) + statement_timestamp(), + transaction_timestamp() -- same as CURRENT_TIMESTAMP ; --\pset title From 913961b2b132199f02071f3ffbb3e538d01432c0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:14 +0300 Subject: [PATCH 247/402] updated postgres_last_analyze.sql --- postgres_last_analyze.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/postgres_last_analyze.sql b/postgres_last_analyze.sql index 509a6af..6e3b62d 100644 --- a/postgres_last_analyze.sql +++ b/postgres_last_analyze.sql @@ -20,17 +20,17 @@ -- Tested on PostgreSQL 9.4+, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - -- not available on PostgreSQL <= 9.3 - n_mod_since_analyze, - last_analyze, - last_autoanalyze, - -- not available on PostgreSQL <= 9.0 - analyze_count, - autoanalyze_count + schemaname, + relname, + -- not available on PostgreSQL <= 9.3 + n_mod_since_analyze, + last_analyze, + last_autoanalyze, + -- not available on PostgreSQL <= 9.0 + analyze_count, + autoanalyze_count FROM pg_stat_user_tables ORDER BY - n_mod_since_analyze DESC, - last_analyze DESC, - last_autoanalyze DESC; + n_mod_since_analyze DESC, + last_analyze DESC, + last_autoanalyze DESC; From 46eb2bcaa2dd3fa4df7554ee021d4f98c5947464 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:17 +0300 Subject: [PATCH 248/402] updated postgres_last_analyze_pre94.sql --- postgres_last_analyze_pre94.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/postgres_last_analyze_pre94.sql b/postgres_last_analyze_pre94.sql index 0ccac1c..ca52251 100644 --- a/postgres_last_analyze_pre94.sql +++ b/postgres_last_analyze_pre94.sql @@ -18,17 +18,17 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - -- not available on PostgreSQL <= 9.3 - --n_mod_since_analyze, - last_analyze, - last_autoanalyze - -- not available on PostgreSQL <= 9.0 - --analyze_count, - --autoanalyze_count + schemaname, + relname, + -- not available on PostgreSQL <= 9.3 + --n_mod_since_analyze, + last_analyze, + last_autoanalyze + -- not available on PostgreSQL <= 9.0 + --analyze_count, + --autoanalyze_count FROM pg_stat_user_tables ORDER BY - --n_mod_since_analyze DESC; - last_analyze DESC, - last_autoanalyze DESC; + --n_mod_since_analyze DESC; + last_analyze DESC, + last_autoanalyze DESC; From de70dcad2901e8178f9fbefcbef19cd7bd2c5d9f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:20 +0300 Subject: [PATCH 249/402] updated postgres_last_vacuum.sql --- postgres_last_vacuum.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/postgres_last_vacuum.sql b/postgres_last_vacuum.sql index 4c90136..457009f 100644 --- a/postgres_last_vacuum.sql +++ b/postgres_last_vacuum.sql @@ -20,20 +20,20 @@ -- Tested on PostgreSQL 9.1+, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - n_live_tup, - n_dead_tup, - n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, - last_vacuum, - last_autovacuum, - -- not available on PostgreSQL <= 9.0 - vacuum_count, - autovacuum_count + schemaname, + relname, + n_live_tup, + n_dead_tup, + n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, + last_vacuum, + last_autovacuum, + -- not available on PostgreSQL <= 9.0 + vacuum_count, + autovacuum_count FROM pg_stat_user_tables WHERE - n_dead_tup > 0 + n_dead_tup > 0 ORDER BY - n_dead_tup DESC, - last_vacuum DESC, - last_autovacuum DESC; + n_dead_tup DESC, + last_vacuum DESC, + last_autovacuum DESC; From 29f7b03703d006c47fe1acfe3b54339012d0f132 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:23 +0300 Subject: [PATCH 250/402] updated postgres_last_vacuum_analyze.sql --- postgres_last_vacuum_analyze.sql | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/postgres_last_vacuum_analyze.sql b/postgres_last_vacuum_analyze.sql index 3fa3be4..a9fbdc0 100644 --- a/postgres_last_vacuum_analyze.sql +++ b/postgres_last_vacuum_analyze.sql @@ -20,26 +20,26 @@ -- Tested on PostgreSQL 9.4+, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - n_live_tup, - n_dead_tup, - n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, - n_mod_since_analyze, - last_vacuum, - last_autovacuum, - last_analyze, - last_autoanalyze, - vacuum_count, - autovacuum_count, - analyze_count, - autoanalyze_count + schemaname, + relname, + n_live_tup, + n_dead_tup, + n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, + n_mod_since_analyze, + last_vacuum, + last_autovacuum, + last_analyze, + last_autoanalyze, + vacuum_count, + autovacuum_count, + analyze_count, + autoanalyze_count FROM - pg_stat_user_tables + pg_stat_user_tables ORDER BY - n_dead_tup DESC, - n_mod_since_analyze DESC, - last_vacuum DESC, - last_analyze DESC, - last_autovacuum DESC, - last_autoanalyze DESC; + n_dead_tup DESC, + n_mod_since_analyze DESC, + last_vacuum DESC, + last_analyze DESC, + last_autovacuum DESC, + last_autoanalyze DESC; From 1befa15a0ef4e3a15afa9b72104a227646671367 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:26 +0300 Subject: [PATCH 251/402] updated postgres_last_vacuum_analyze_pre94.sql --- postgres_last_vacuum_analyze_pre94.sql | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/postgres_last_vacuum_analyze_pre94.sql b/postgres_last_vacuum_analyze_pre94.sql index 07db7f1..2b4276b 100644 --- a/postgres_last_vacuum_analyze_pre94.sql +++ b/postgres_last_vacuum_analyze_pre94.sql @@ -18,28 +18,28 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - n_live_tup, - n_dead_tup, - n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, - -- not available on PostgreSQL <= 9.3 - --n_mod_since_analyze, - last_vacuum, - last_autovacuum, - last_analyze, - last_autoanalyze - -- not available on PostgreSQL <= 9.0 - --vacuum_count, - --autovacuum_count, - -- not available on PostgreSQL <= 9.0 - --analyze_count, - --autoanalyze_count + schemaname, + relname, + n_live_tup, + n_dead_tup, + n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, + -- not available on PostgreSQL <= 9.3 + --n_mod_since_analyze, + last_vacuum, + last_autovacuum, + last_analyze, + last_autoanalyze + -- not available on PostgreSQL <= 9.0 + --vacuum_count, + --autovacuum_count, + -- not available on PostgreSQL <= 9.0 + --analyze_count, + --autoanalyze_count FROM - pg_stat_user_tables + pg_stat_user_tables ORDER BY - n_dead_tup DESC, - last_vacuum DESC, - last_analyze DESC, - last_autovacuum DESC, - last_autoanalyze DESC; + n_dead_tup DESC, + last_vacuum DESC, + last_analyze DESC, + last_autovacuum DESC, + last_autoanalyze DESC; From 9f8d38e546770b853879e62a20f862106a68c4cd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:29 +0300 Subject: [PATCH 252/402] updated postgres_last_vacuum_pre91.sql --- postgres_last_vacuum_pre91.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/postgres_last_vacuum_pre91.sql b/postgres_last_vacuum_pre91.sql index c3bdd96..dad83b8 100644 --- a/postgres_last_vacuum_pre91.sql +++ b/postgres_last_vacuum_pre91.sql @@ -18,20 +18,20 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - n_live_tup, - n_dead_tup, - n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, - last_vacuum, - last_autovacuum - -- not available on PostgreSQL <= 9.0 - --vacuum_count, - --autovacuum_count + schemaname, + relname, + n_live_tup, + n_dead_tup, + n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage, + last_vacuum, + last_autovacuum + -- not available on PostgreSQL <= 9.0 + --vacuum_count, + --autovacuum_count FROM pg_stat_user_tables WHERE - n_dead_tup > 0 + n_dead_tup > 0 ORDER BY - n_dead_tup DESC, - last_vacuum DESC, - last_autovacuum DESC; + n_dead_tup DESC, + last_vacuum DESC, + last_autovacuum DESC; From badb53f146c90d0d0ea8327c6d7d5c8dcdd8a631 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:32 +0300 Subject: [PATCH 253/402] updated postgres_locks.sql --- postgres_locks.sql | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/postgres_locks.sql b/postgres_locks.sql index c5a26d0..1490290 100644 --- a/postgres_locks.sql +++ b/postgres_locks.sql @@ -20,28 +20,28 @@ -- https://wiki.postgresql.org/wiki/Lock_Monitoring SELECT - t.schemaname, - t.relname, - -- l.database, -- id number is less useful, take schemaname from join instead - l.locktype, - page, - virtualtransaction, - pid, - mode, - granted + t.schemaname, + t.relname, + -- l.database, -- id number is less useful, take schemaname from join instead + l.locktype, + page, + virtualtransaction, + pid, + mode, + granted FROM - pg_locks l, - --pg_stat_user_tables t - pg_stat_all_tables t + pg_locks l, + --pg_stat_user_tables t + pg_stat_all_tables t WHERE - l.relation = t.relid + l.relation = t.relid ORDER BY - relation ASC; + relation ASC; SELECT - relation::regclass AS relation_regclass, - * + relation::regclass AS relation_regclass, + * FROM - pg_locks + pg_locks WHERE - NOT granted; + NOT granted; From bdc2c7e74f8e74e073459dbfdb3d2652db95117c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:39 +0300 Subject: [PATCH 254/402] updated postgres_locks_blocked.sql --- postgres_locks_blocked.sql | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/postgres_locks_blocked.sql b/postgres_locks_blocked.sql index 939d155..a2078ab 100644 --- a/postgres_locks_blocked.sql +++ b/postgres_locks_blocked.sql @@ -22,35 +22,35 @@ -- https://wiki.postgresql.org/wiki/Lock_Monitoring SELECT - blocked_locks.pid AS blocked_pid, - blocked_activity.usename AS blocked_user, - blocking_locks.pid AS blocking_pid, - blocking_activity.usename AS blocking_user, - blocked_activity.query AS blocked_statement, - blocking_activity.query AS current_statement_in_blocking_process + blocked_locks.pid AS blocked_pid, + blocked_activity.usename AS blocked_user, + blocking_locks.pid AS blocking_pid, + blocking_activity.usename AS blocking_user, + blocked_activity.query AS blocked_statement, + blocking_activity.query AS current_statement_in_blocking_process FROM - pg_catalog.pg_locks AS blocked_locks + pg_catalog.pg_locks AS blocked_locks JOIN - pg_catalog.pg_stat_activity AS blocked_activity + pg_catalog.pg_stat_activity AS blocked_activity ON - blocked_activity.pid = blocked_locks.pid + blocked_activity.pid = blocked_locks.pid JOIN - pg_catalog.pg_locks AS blocking_locks + pg_catalog.pg_locks AS blocking_locks ON - blocking_locks.locktype = blocked_locks.locktype - AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database - AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation - AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page - AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple - AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid - AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid - AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid - AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid - AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid - AND blocking_locks.pid != blocked_locks.pid + blocking_locks.locktype = blocked_locks.locktype + AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database + AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation + AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page + AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple + AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid + AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid + AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid + AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid + AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid + AND blocking_locks.pid != blocked_locks.pid JOIN - pg_catalog.pg_stat_activity blocking_activity + pg_catalog.pg_stat_activity blocking_activity ON - blocking_activity.pid = blocking_locks.pid + blocking_activity.pid = blocking_locks.pid WHERE - NOT blocked_locks.granted; + NOT blocked_locks.granted; From a0f6c4dd785875408575c6c373a89a8543f766b2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:43 +0300 Subject: [PATCH 255/402] updated postgres_locks_blocked_application.sql --- postgres_locks_blocked_application.sql | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/postgres_locks_blocked_application.sql b/postgres_locks_blocked_application.sql index da9e4f5..8beabd7 100644 --- a/postgres_locks_blocked_application.sql +++ b/postgres_locks_blocked_application.sql @@ -22,37 +22,37 @@ -- https://wiki.postgresql.org/wiki/Lock_Monitoring SELECT - blocked_locks.pid AS blocked_pid, - blocked_activity.usename AS blocked_user, - blocking_locks.pid AS blocking_pid, - blocking_activity.usename AS blocking_user, - blocked_activity.query AS blocked_statement, - blocking_activity.query AS current_statement_in_blocking_process, - blocked_activity.application_name AS blocked_application, - blocking_activity.application_name AS blocking_application + blocked_locks.pid AS blocked_pid, + blocked_activity.usename AS blocked_user, + blocking_locks.pid AS blocking_pid, + blocking_activity.usename AS blocking_user, + blocked_activity.query AS blocked_statement, + blocking_activity.query AS current_statement_in_blocking_process, + blocked_activity.application_name AS blocked_application, + blocking_activity.application_name AS blocking_application FROM - pg_catalog.pg_locks blocked_locks + pg_catalog.pg_locks blocked_locks JOIN - pg_catalog.pg_stat_activity blocked_activity + pg_catalog.pg_stat_activity blocked_activity ON - blocked_activity.pid = blocked_locks.pid + blocked_activity.pid = blocked_locks.pid JOIN - pg_catalog.pg_locks blocking_locks + pg_catalog.pg_locks blocking_locks ON - blocking_locks.locktype = blocked_locks.locktype - AND blocking_locks.DATABASE IS NOT DISTINCT FROM blocked_locks.DATABASE - AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation - AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page - AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple - AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid - AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid - AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid - AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid - AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid - AND blocking_locks.pid != blocked_locks.pid + blocking_locks.locktype = blocked_locks.locktype + AND blocking_locks.DATABASE IS NOT DISTINCT FROM blocked_locks.DATABASE + AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation + AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page + AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple + AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid + AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid + AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid + AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid + AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid + AND blocking_locks.pid != blocked_locks.pid JOIN - pg_catalog.pg_stat_activity blocking_activity + pg_catalog.pg_stat_activity blocking_activity ON - blocking_activity.pid = blocking_locks.pid + blocking_activity.pid = blocking_locks.pid WHERE - NOT blocked_locks.granted; + NOT blocked_locks.granted; From 6fa71b0d795a37354630239f95421de4a7d189a2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:47 +0300 Subject: [PATCH 256/402] updated postgres_locks_query_age.sql --- postgres_locks_query_age.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/postgres_locks_query_age.sql b/postgres_locks_query_age.sql index 67afddb..4edfffa 100644 --- a/postgres_locks_query_age.sql +++ b/postgres_locks_query_age.sql @@ -22,21 +22,21 @@ -- https://wiki.postgresql.org/wiki/Lock_Monitoring SELECT - a.datname, - l.relation::regclass, - l.transactionid, - l.mode, - l.GRANTED, - a.usename, - a.query, - a.query_start, - age(now(), a.query_start) AS "age", - a.pid + a.datname, + l.relation::regclass, + l.transactionid, + l.mode, + l.GRANTED, + a.usename, + a.query, + a.query_start, + age(now(), a.query_start) AS "age", + a.pid FROM - pg_stat_activity a + pg_stat_activity a JOIN - pg_locks l + pg_locks l ON - l.pid = a.pid + l.pid = a.pid ORDER BY - a.query_start; + a.query_start; From 1db6d6be60279aabcfddd57d0ee9f670a90059bb Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:50 +0300 Subject: [PATCH 257/402] updated postgres_locks_query_age_pre92.sql --- postgres_locks_query_age_pre92.sql | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_locks_query_age_pre92.sql b/postgres_locks_query_age_pre92.sql index 2dec171..9c63bcc 100644 --- a/postgres_locks_query_age_pre92.sql +++ b/postgres_locks_query_age_pre92.sql @@ -22,25 +22,25 @@ -- https://wiki.postgresql.org/wiki/Lock_Monitoring SELECT - a.datname, - c.relname, - l.transactionid, - l.mode, - l.granted, - a.usename, - a.current_query, - a.query_start, - age(now(), a.query_start) as "age", - a.procpid + a.datname, + c.relname, + l.transactionid, + l.mode, + l.granted, + a.usename, + a.current_query, + a.query_start, + age(now(), a.query_start) as "age", + a.procpid FROM - pg_stat_activity a + pg_stat_activity a JOIN - pg_locks l + pg_locks l ON - l.pid = a.procpid + l.pid = a.procpid JOIN - pg_class c + pg_class c ON - c.oid = l.relation + c.oid = l.relation ORDER BY - a.query_start; + a.query_start; From 5c748c952e787d83aeb4aba7dd1a6c4f2cdf52c2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:53 +0300 Subject: [PATCH 258/402] updated postgres_queries_slow.sql --- postgres_queries_slow.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/postgres_queries_slow.sql b/postgres_queries_slow.sql index f131224..0eb9225 100644 --- a/postgres_queries_slow.sql +++ b/postgres_queries_slow.sql @@ -22,19 +22,19 @@ -- Tested on PostgreSQL 9.6+, 10x, 11.x, 12.x, 13.0 SELECT - now() - query_start as "runtime", - usename, - datname, - -- not available on PostgreSQL < 9.6 - wait_event, - -- not available on PostgreSQL < 9.2 - state, - -- current_query on PostgreSQL < 9.2 - query + now() - query_start as "runtime", + usename, + datname, + -- not available on PostgreSQL < 9.6 + wait_event, + -- not available on PostgreSQL < 9.2 + state, + -- current_query on PostgreSQL < 9.2 + query FROM - pg_stat_activity + pg_stat_activity WHERE - -- can't use 'runtime' here - now() - query_start > '30 seconds'::interval + -- can't use 'runtime' here + now() - query_start > '30 seconds'::interval ORDER BY - runtime DESC; + runtime DESC; From f1032d1d715851947ce6ae51de1c8322982b806f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:56 +0300 Subject: [PATCH 259/402] updated postgres_queries_slow_pre92.sql --- postgres_queries_slow_pre92.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/postgres_queries_slow_pre92.sql b/postgres_queries_slow_pre92.sql index 3294aaf..7379725 100644 --- a/postgres_queries_slow_pre92.sql +++ b/postgres_queries_slow_pre92.sql @@ -22,19 +22,19 @@ -- Tested on PostgreSQL 8.4, 9.0, 9.1 SELECT - now() - query_start as "runtime", - usename, - datname, - -- not available on PostgreSQL < 9.6 - -- wait_event, - waiting, - -- not available on PostgreSQL < 9.2 - --state, - current_query + now() - query_start as "runtime", + usename, + datname, + -- not available on PostgreSQL < 9.6 + -- wait_event, + waiting, + -- not available on PostgreSQL < 9.2 + --state, + current_query FROM - pg_stat_activity + pg_stat_activity WHERE - -- can't use 'runtime' here - now() - query_start > '30 seconds'::interval + -- can't use 'runtime' here + now() - query_start > '30 seconds'::interval ORDER BY - runtime DESC; + runtime DESC; From 73feef41fbb4827cd2a692e6afa994792428f985 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:47:59 +0300 Subject: [PATCH 260/402] updated postgres_queries_slow_pre96.sql --- postgres_queries_slow_pre96.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/postgres_queries_slow_pre96.sql b/postgres_queries_slow_pre96.sql index 70d3b5d..dad7aa3 100644 --- a/postgres_queries_slow_pre96.sql +++ b/postgres_queries_slow_pre96.sql @@ -22,19 +22,19 @@ -- Tested on PostgreSQL 9.2, 9.3, 9.4, 9.5 SELECT - now() - query_start as "runtime", - usename, - datname, - -- not available on PostgreSQL < 9.6 - -- wait_event, - waiting, - -- not available on PostgreSQL < 9.2 - state, - query + now() - query_start as "runtime", + usename, + datname, + -- not available on PostgreSQL < 9.6 + -- wait_event, + waiting, + -- not available on PostgreSQL < 9.2 + state, + query FROM - pg_stat_activity + pg_stat_activity WHERE - -- can't use 'runtime' here - now() - query_start > '30 seconds'::interval + -- can't use 'runtime' here + now() - query_start > '30 seconds'::interval ORDER BY - runtime DESC; + runtime DESC; From 86557e38e1b6f7bdeb6c08cea3c5458450f39d16 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:02 +0300 Subject: [PATCH 261/402] updated postgres_query_cache_hit_ratio.sql --- postgres_query_cache_hit_ratio.sql | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_query_cache_hit_ratio.sql b/postgres_query_cache_hit_ratio.sql index 7adcca7..1b2b453 100644 --- a/postgres_query_cache_hit_ratio.sql +++ b/postgres_query_cache_hit_ratio.sql @@ -25,24 +25,24 @@ CREATE EXTENSION IF NOT EXISTS pg_stat_statements; SELECT - calls, - rows, - shared_blks_hit, - shared_blks_read, - -- using greatest() to avoid divide by zero error, by ensuring we divide by at least 1 - shared_blks_hit / - GREATEST(shared_blks_hit + shared_blks_read, 1)::float AS shared_blks_hit_ratio, - -- casting divisor to float to avoid getting integer maths returning zeros instead of fractional ratios - local_blks_hit, - local_blks_read, - local_blks_hit / - GREATEST(local_blks_hit + local_blks_read, 1)::float AS local_blks_hit_ratio, - query + calls, + rows, + shared_blks_hit, + shared_blks_read, + -- using greatest() to avoid divide by zero error, by ensuring we divide by at least 1 + shared_blks_hit / + GREATEST(shared_blks_hit + shared_blks_read, 1)::float AS shared_blks_hit_ratio, + -- casting divisor to float to avoid getting integer maths returning zeros instead of fractional ratios + local_blks_hit, + local_blks_read, + local_blks_hit / + GREATEST(local_blks_hit + local_blks_read, 1)::float AS local_blks_hit_ratio, + query FROM - pg_stat_statements + pg_stat_statements --ORDER BY rows DESC ORDER BY - shared_blks_hit_ratio DESC, - local_blks_hit_ratio DESC, - rows DESC + shared_blks_hit_ratio DESC, + local_blks_hit_ratio DESC, + rows DESC LIMIT 100; From db56705a96ee6bde9325489008ed2a4f4ae858c8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:06 +0300 Subject: [PATCH 262/402] updated postgres_query_times.sql --- postgres_query_times.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/postgres_query_times.sql b/postgres_query_times.sql index 0623a80..4c6f856 100644 --- a/postgres_query_times.sql +++ b/postgres_query_times.sql @@ -28,20 +28,20 @@ CREATE EXTENSION IF NOT EXISTS pg_stat_statements; SELECT - calls, - rows, - ROUND((total_exec_time::numeric / 1000), 4) AS total_secs, - -- newer versions of PostgreSQL have mean_exec_time field, don't need to calculate - --ROUND((total_exec_time / 1000 / calls)::numeric, 4) AS average_secs, - ROUND(mean_exec_time::numeric / 1000, 4) AS average_secs, - ROUND(min_exec_time::numeric / 1000, 4) AS min_secs, - ROUND(max_exec_time::numeric / 1000, 4) AS max_secs, - ROUND(stddev_exec_time::numeric / 1000, 4) AS stddev_secs, - query + calls, + rows, + ROUND((total_exec_time::numeric / 1000), 4) AS total_secs, + -- newer versions of PostgreSQL have mean_exec_time field, don't need to calculate + --ROUND((total_exec_time / 1000 / calls)::numeric, 4) AS average_secs, + ROUND(mean_exec_time::numeric / 1000, 4) AS average_secs, + ROUND(min_exec_time::numeric / 1000, 4) AS min_secs, + ROUND(max_exec_time::numeric / 1000, 4) AS max_secs, + ROUND(stddev_exec_time::numeric / 1000, 4) AS stddev_secs, + query FROM - pg_stat_statements + pg_stat_statements ORDER BY - average_secs DESC, - calls DESC, - rows DESC + average_secs DESC, + calls DESC, + rows DESC LIMIT 100; From 025f18be6780bc4d897528973f8886c3e62b5c18 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:08 +0300 Subject: [PATCH 263/402] updated postgres_query_times_pre13.sql --- postgres_query_times_pre13.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/postgres_query_times_pre13.sql b/postgres_query_times_pre13.sql index b59ced6..6f49df9 100644 --- a/postgres_query_times_pre13.sql +++ b/postgres_query_times_pre13.sql @@ -25,20 +25,20 @@ CREATE EXTENSION IF NOT EXISTS pg_stat_statements; SELECT - calls, - rows, - ROUND((total_time::numeric / 1000), 4) AS total_secs, - -- newer versions of PostgreSQL have mean_time field, don't need to calculate - --ROUND((total_time / 1000 / calls)::numeric, 4) AS average_secs, - ROUND(mean_time::numeric / 1000, 4) AS average_secs, - ROUND(min_time::numeric / 1000, 4) AS min_secs, - ROUND(max_time::numeric / 1000, 4) AS max_secs, - ROUND(stddev_time::numeric / 1000, 4) AS stddev_secs, - query + calls, + rows, + ROUND((total_time::numeric / 1000), 4) AS total_secs, + -- newer versions of PostgreSQL have mean_time field, don't need to calculate + --ROUND((total_time / 1000 / calls)::numeric, 4) AS average_secs, + ROUND(mean_time::numeric / 1000, 4) AS average_secs, + ROUND(min_time::numeric / 1000, 4) AS min_secs, + ROUND(max_time::numeric / 1000, 4) AS max_secs, + ROUND(stddev_time::numeric / 1000, 4) AS stddev_secs, + query FROM - pg_stat_statements + pg_stat_statements ORDER BY - average_secs DESC, - calls DESC, - rows DESC + average_secs DESC, + calls DESC, + rows DESC LIMIT 100; From 4e435c575ebb3940070aa8cace40752e858fa87a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:11 +0300 Subject: [PATCH 264/402] updated postgres_query_times_pre95.sql --- postgres_query_times_pre95.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/postgres_query_times_pre95.sql b/postgres_query_times_pre95.sql index 9f6b58c..6324efe 100644 --- a/postgres_query_times_pre95.sql +++ b/postgres_query_times_pre95.sql @@ -29,16 +29,16 @@ CREATE EXTENSION IF NOT EXISTS pg_stat_statements; SELECT - calls, - rows, - ROUND(total_time::numeric / 1000, 4) AS total_secs, - -- newer versions of PostgreSQL have mean_time field, but we have to calculate on PostgreSQL <= 9.4 - ROUND(total_time::numeric / 1000 / GREATEST(calls, 1), 4) AS average_secs, - query + calls, + rows, + ROUND(total_time::numeric / 1000, 4) AS total_secs, + -- newer versions of PostgreSQL have mean_time field, but we have to calculate on PostgreSQL <= 9.4 + ROUND(total_time::numeric / 1000 / GREATEST(calls, 1), 4) AS average_secs, + query FROM - pg_stat_statements + pg_stat_statements ORDER BY - average_secs DESC, - calls DESC, - rows DESC + average_secs DESC, + calls DESC, + rows DESC LIMIT 100; From 4cc082c8559ffdf0636fb0c76dfd71c0cc043cfd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:13 +0300 Subject: [PATCH 265/402] updated postgres_recovery.sql --- postgres_recovery.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/postgres_recovery.sql b/postgres_recovery.sql index c1627db..369a95d 100644 --- a/postgres_recovery.sql +++ b/postgres_recovery.sql @@ -20,12 +20,12 @@ -- Tested on PostgreSQL 10.x, 11.x, 12.x, 13.0 SELECT - pg_is_in_backup(), - pg_is_in_recovery(), - pg_backup_start_time(), - -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql - ( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", - ( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", - ( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", - ( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" + pg_is_in_backup(), + pg_is_in_recovery(), + pg_backup_start_time(), + -- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql + ( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()", + ( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()", + ( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()", + ( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()" ; From 19ee0cefc5869bd3be68b2f6207a0da280609e63 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:16 +0300 Subject: [PATCH 266/402] updated postgres_running_queries.sql --- postgres_running_queries.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/postgres_running_queries.sql b/postgres_running_queries.sql index 338d883..9c26cac 100644 --- a/postgres_running_queries.sql +++ b/postgres_running_queries.sql @@ -20,16 +20,16 @@ -- Tested on PostgreSQL 9.2+, 10.x, 11.x, 12.x, 13.0 SELECT - pid, - age(clock_timestamp(), query_start), - usename, - application_name, - query + pid, + age(clock_timestamp(), query_start), + usename, + application_name, + query FROM - pg_stat_activity + pg_stat_activity WHERE - state != 'idle' - AND - query NOT ILIKE '%pg_stat_activity%' + state != 'idle' + AND + query NOT ILIKE '%pg_stat_activity%' ORDER BY - query_start DESC; + query_start DESC; From 52d0f57b7fefcaf9337124055dc22a09bd43760e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:18 +0300 Subject: [PATCH 267/402] updated postgres_running_queries_pre92.sql --- postgres_running_queries_pre92.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/postgres_running_queries_pre92.sql b/postgres_running_queries_pre92.sql index 3d327c7..961af66 100644 --- a/postgres_running_queries_pre92.sql +++ b/postgres_running_queries_pre92.sql @@ -20,15 +20,15 @@ -- Tested on PostgreSQL 8.4, 9.0, 9.1 SELECT - procpid, - age(clock_timestamp(), query_start), - usename, - current_query + procpid, + age(clock_timestamp(), query_start), + usename, + current_query FROM - pg_stat_activity + pg_stat_activity WHERE - current_query != '' - AND - current_query NOT ILIKE '%pg_stat_activity%' + current_query != '' + AND + current_query NOT ILIKE '%pg_stat_activity%' ORDER BY - query_start DESC; + query_start DESC; From c0240ea989e31051da8f94f56322408e40f9d0a4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:21 +0300 Subject: [PATCH 268/402] updated postgres_sequences_restart_all.sql --- postgres_sequences_restart_all.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgres_sequences_restart_all.sql b/postgres_sequences_restart_all.sql index 914bba2..07e285a 100644 --- a/postgres_sequences_restart_all.sql +++ b/postgres_sequences_restart_all.sql @@ -18,8 +18,8 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - 'ALTER SEQUENCE ' || relname || ' RESTART;' + 'ALTER SEQUENCE ' || relname || ' RESTART;' FROM - pg_class + pg_class WHERE - relkind = 'S'; + relkind = 'S'; From 71c6d8b0ce0c474837b544ad636bf9116d1b51a1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:24 +0300 Subject: [PATCH 269/402] updated postgres_sessions.sql --- postgres_sessions.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/postgres_sessions.sql b/postgres_sessions.sql index 77afa40..43f2550 100644 --- a/postgres_sessions.sql +++ b/postgres_sessions.sql @@ -20,18 +20,18 @@ -- Tested on PostgreSQL 10.x, 11.x, 12.x, 13.0 SELECT - pid, - usename, - client_addr, - client_hostname, - client_port, - backend_start, - query_start, - state, - -- not available on PostgreSQL < 10 - backend_type + pid, + usename, + client_addr, + client_hostname, + client_port, + backend_start, + query_start, + state, + -- not available on PostgreSQL < 10 + backend_type FROM - pg_stat_activity + pg_stat_activity ORDER BY - -- not available on PostgreSQL < 10 - backend_type; + -- not available on PostgreSQL < 10 + backend_type; From 261b1bd2e50cc845645104de44c27a07eefba7fa Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:26 +0300 Subject: [PATCH 270/402] updated postgres_sessions_pre10.sql --- postgres_sessions_pre10.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/postgres_sessions_pre10.sql b/postgres_sessions_pre10.sql index 4427d36..8900e28 100644 --- a/postgres_sessions_pre10.sql +++ b/postgres_sessions_pre10.sql @@ -20,13 +20,13 @@ -- Tested on PostgreSQL 9.2 - 9.6, 10.x, 11.x, 12.x, 13.0 SELECT - pid, - usename, - client_addr, - client_hostname, - client_port, - backend_start, - query_start, - state + pid, + usename, + client_addr, + client_hostname, + client_port, + backend_start, + query_start, + state FROM - pg_stat_activity; + pg_stat_activity; From 1ce5e78e706f74acdca6c724ec0de7561474f943 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:29 +0300 Subject: [PATCH 271/402] updated postgres_sessions_state_count.sql --- postgres_sessions_state_count.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/postgres_sessions_state_count.sql b/postgres_sessions_state_count.sql index 1bddf08..1951e82 100644 --- a/postgres_sessions_state_count.sql +++ b/postgres_sessions_state_count.sql @@ -20,11 +20,11 @@ -- Tested on PostgreSQL 9.2+, 10.x, 11.x, 12.x, 13.0 SELECT - count(1), - state + count(1), + state FROM - pg_stat_activity + pg_stat_activity GROUP BY - state + state ORDER BY - 1 DESC; + 1 DESC; From 49ef67cdf6075348260e991735ba650263212a21 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:31 +0300 Subject: [PATCH 272/402] updated postgres_settings.sql --- postgres_settings.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/postgres_settings.sql b/postgres_settings.sql index eb7f453..07b246a 100644 --- a/postgres_settings.sql +++ b/postgres_settings.sql @@ -22,18 +22,18 @@ --\pset title 'pg_settings' \echo pg_settings: SELECT - name, - setting, - unit, - context + name, + setting, + unit, + context FROM - pg_settings; + pg_settings; \echo --\pset title 'pg_file_settings' \echo pg_file_settings: SELECT - * + * FROM - pg_file_settings; + pg_file_settings; From 3b8ba63beeccd3fba55fded18f655c785727c4d2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:34 +0300 Subject: [PATCH 273/402] updated postgres_settings_auth.sql --- postgres_settings_auth.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_auth.sql b/postgres_settings_auth.sql index 34bd991..1b25634 100644 --- a/postgres_settings_auth.sql +++ b/postgres_settings_auth.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-AUTHENTICATION SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Connections and Authentication / Authentication - category ILIKE '% / Authentication%'; + -- Connections and Authentication / Authentication + category ILIKE '% / Authentication%'; From 1745db68087a03e68c25c28fc81a4976d36b8f16 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:37 +0300 Subject: [PATCH 274/402] updated postgres_settings_autovacuum.sql --- postgres_settings_autovacuum.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_autovacuum.sql b/postgres_settings_autovacuum.sql index cbfc06a..62a337f 100644 --- a/postgres_settings_autovacuum.sql +++ b/postgres_settings_autovacuum.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-autovacuum.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Autovacuum - category ILIKE '%Autovacuum%'; + -- Autovacuum + category ILIKE '%Autovacuum%'; From 6c0a9fd231b9a00a72711c0c42f39a5ab02cc2e9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:39 +0300 Subject: [PATCH 275/402] updated postgres_settings_client_connection.sql --- postgres_settings_client_connection.sql | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/postgres_settings_client_connection.sql b/postgres_settings_client_connection.sql index 07aa128..a91bb1b 100644 --- a/postgres_settings_client_connection.sql +++ b/postgres_settings_client_connection.sql @@ -24,24 +24,24 @@ -- https://www.postgresql.org/docs/12/runtime-config-client.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Client Connection Defaults / Statement Behavior - -- Client Connection Defaults / Locale and Formatting - -- Client Connection Defaults / Other Defaults - -- Client Connection Defaults / Shared Library Preloading - category ILIKE '%Client Connection Defaults%'; + -- Client Connection Defaults / Statement Behavior + -- Client Connection Defaults / Locale and Formatting + -- Client Connection Defaults / Other Defaults + -- Client Connection Defaults / Shared Library Preloading + category ILIKE '%Client Connection Defaults%'; From 64be255adf0299016616bd9f51cd809cfaef3a80 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:42 +0300 Subject: [PATCH 276/402] updated postgres_settings_compatibility.sql --- postgres_settings_compatibility.sql | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_settings_compatibility.sql b/postgres_settings_compatibility.sql index 34ecc0f..bd6aea4 100644 --- a/postgres_settings_compatibility.sql +++ b/postgres_settings_compatibility.sql @@ -24,22 +24,22 @@ -- https://www.postgresql.org/docs/12/runtime-config-compatible.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Version and Platform Compatibility / Previous PostgreSQL Versions - -- Version and Platform Compatibility / Other Platforms and Clients - category ILIKE '%Compatibility%'; + -- Version and Platform Compatibility / Previous PostgreSQL Versions + -- Version and Platform Compatibility / Other Platforms and Clients + category ILIKE '%Compatibility%'; From 4e78b8fa1db2688d1451ac7b0554b82d90ab41c2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:44 +0300 Subject: [PATCH 277/402] updated postgres_settings_connections.sql --- postgres_settings_connections.sql | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_connections.sql b/postgres_settings_connections.sql index c077ddb..7cefeeb 100644 --- a/postgres_settings_connections.sql +++ b/postgres_settings_connections.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Connections and Authentication / Connection Settings - category ILIKE '% / Connection Settings%'; + -- Connections and Authentication / Connection Settings + category ILIKE '% / Connection Settings%'; From 74b2028f2e3040272c670078fa4efa2635910dc0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:46 +0300 Subject: [PATCH 278/402] updated postgres_settings_developer.sql --- postgres_settings_developer.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_developer.sql b/postgres_settings_developer.sql index cfa2c80..9bbe461 100644 --- a/postgres_settings_developer.sql +++ b/postgres_settings_developer.sql @@ -22,21 +22,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-developer.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Developer Options - category ILIKE '%Developer%'; + -- Developer Options + category ILIKE '%Developer%'; From b4a708760e38847b3449f760855726522fcb5a5c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:49 +0300 Subject: [PATCH 279/402] updated postgres_settings_error_handling.sql --- postgres_settings_error_handling.sql | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_error_handling.sql b/postgres_settings_error_handling.sql index 8ac3ea7..4768b88 100644 --- a/postgres_settings_error_handling.sql +++ b/postgres_settings_error_handling.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-error-handling.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Error Handling - category ILIKE '%Error%'; + -- Error Handling + category ILIKE '%Error%'; From 41ff60707c6ed52bad29e67f2688d5b791780e84 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:51 +0300 Subject: [PATCH 280/402] updated postgres_settings_files.sql --- postgres_settings_files.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_files.sql b/postgres_settings_files.sql index d2aa4e7..7898468 100644 --- a/postgres_settings_files.sql +++ b/postgres_settings_files.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-file-locations.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- File Locations - category ILIKE '%File Locations%'; + -- File Locations + category ILIKE '%File Locations%'; From dc8f1051a33bf350c456a89e056a2116a28d42f7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:54 +0300 Subject: [PATCH 281/402] updated postgres_settings_locking.sql --- postgres_settings_locking.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_locking.sql b/postgres_settings_locking.sql index d5afe5c..0141f4f 100644 --- a/postgres_settings_locking.sql +++ b/postgres_settings_locking.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-locks.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Lock Management - category ILIKE '%Lock%'; + -- Lock Management + category ILIKE '%Lock%'; From 8e1eb2b8f9129e7e4d10e63984f34da393f8de68 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:48:58 +0300 Subject: [PATCH 282/402] updated postgres_settings_logging.sql --- postgres_settings_logging.sql | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_settings_logging.sql b/postgres_settings_logging.sql index 39613e0..a8e87f7 100644 --- a/postgres_settings_logging.sql +++ b/postgres_settings_logging.sql @@ -24,22 +24,22 @@ -- https://www.postgresql.org/docs/12/runtime-config-logging.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Reporting and Logging / What to Log - -- broader '%Log%' pulls in WAL settings which we don't want here - category ILIKE '%Logging%'; + -- Reporting and Logging / What to Log + -- broader '%Log%' pulls in WAL settings which we don't want here + category ILIKE '%Logging%'; From 67072686f213cd2010cb3f9fa3c0f931a8a13c33 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:49:00 +0300 Subject: [PATCH 283/402] updated postgres_settings_memory.sql --- postgres_settings_memory.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_memory.sql b/postgres_settings_memory.sql index cef3de3..f2b4852 100644 --- a/postgres_settings_memory.sql +++ b/postgres_settings_memory.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Resource Usage / Memory - category ILIKE '%Memory%'; + -- Resource Usage / Memory + category ILIKE '%Memory%'; From 8f875f5b9c1c564616c464297d9ed18427589a89 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:04 +0300 Subject: [PATCH 284/402] updated postgres_settings_misc.sql --- postgres_settings_misc.sql | 198 ++++++++++++++++++------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/postgres_settings_misc.sql b/postgres_settings_misc.sql index 6e49a9d..47d11f6 100644 --- a/postgres_settings_misc.sql +++ b/postgres_settings_misc.sql @@ -26,105 +26,105 @@ -- https://www.postgresql.org/docs/12/runtime-config.html SELECT - name, - setting, - category, - vartype, - short_desc, - enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + category, + vartype, + short_desc, + enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- inverse of all adjacent postgres_settings_*.sql scripts to check for any other settings - -- - -- Connections and Authentication / Authentication - category NOT ILIKE '% / Authentication%' - AND - -- Autovacuum - category NOT ILIKE '%Autovacuum%' - AND - -- Client Connection Defaults / Statement Behavior - -- Client Connection Defaults / Locale and Formatting - -- Client Connection Defaults / Other Defaults - -- Client Connection Defaults / Shared Library Preloading - category NOT ILIKE '%Client Connection Defaults%' - AND - -- Version and Platform Compatibility / Previous PostgreSQL Versions - -- Version and Platform Compatibility / Other Platforms and Clients - category NOT ILIKE '%Compatibility%' - AND - -- Connections and Authentication / Connection Settings - category NOT ILIKE '% / Connection Settings%' - AND - -- Developer Options - category NOT ILIKE '%Developer%' - AND - -- Error Handling - category NOT ILIKE '%Error%' - AND - -- File Locations - category NOT ILIKE '%File Locations%' - AND - -- Lock Management - category NOT ILIKE '%Lock%' - AND - -- Reporting and Logging / What to Log - -- broader '%Log%' pulls in WAL settings which we don't want here - category NOT ILIKE '%Logging%' - AND - -- Resource Usage / Memory - category NOT ILIKE '%Memory%' - AND - -- Preset Options - category NOT ILIKE '%Preset Options%' - AND - -- Query Tuning / Planner Method Configuration - -- Query Tuning / Planner Cost Constants - -- Query Tuning / Other Planner Options - -- Query Tuning / Genetic Query Optimizer - -- Statistics / Query and Index Statistics Collector - -- - -- more general to pull in 'track_activities' from category 'Statistics / Query and Index Statistics Collector' - --category NOT ILIKE '%Query Tuning%' - category NOT ILIKE '%Query%' - AND - -- Replication / Standby Servers - -- Replication / Sending Servers - -- Replication / Master Server - -- Replication / Subscribers - -- Replication - category NOT ILIKE '%Replication%' - AND - -- Resource Usage / Memory - -- Resource Usage / Asynchronous Behavior - -- Resource Usage / Cost-Based Vacuum Delay - -- Resource Usage / Background Writer - -- Resource Usage / Disk - -- Resource Usage / Kernel Resources - category NOT ILIKE '%Resource%' - AND - name NOT ILIKE '%ssl%' - AND - -- Connections and Authentication / SSL - category NOT ILIKE '%SSL%' - AND - short_desc NOT ILIKE '%SSL%' - AND - -- Statistics / Query and Index Statistics Collector - -- Statistics / Monitoring - category NOT ILIKE '%Statistics%' - AND - -- Write-Ahead Log / Settings - -- Write-Ahead Log / Recovery Target - -- Write-Ahead Log / Checkpoints - -- Write-Ahead Log / Archive Recovery - -- Write-Ahead Log / Archiving - category NOT ILIKE '%Write-Ahead Log%' + -- inverse of all adjacent postgres_settings_*.sql scripts to check for any other settings + -- + -- Connections and Authentication / Authentication + category NOT ILIKE '% / Authentication%' + AND + -- Autovacuum + category NOT ILIKE '%Autovacuum%' + AND + -- Client Connection Defaults / Statement Behavior + -- Client Connection Defaults / Locale and Formatting + -- Client Connection Defaults / Other Defaults + -- Client Connection Defaults / Shared Library Preloading + category NOT ILIKE '%Client Connection Defaults%' + AND + -- Version and Platform Compatibility / Previous PostgreSQL Versions + -- Version and Platform Compatibility / Other Platforms and Clients + category NOT ILIKE '%Compatibility%' + AND + -- Connections and Authentication / Connection Settings + category NOT ILIKE '% / Connection Settings%' + AND + -- Developer Options + category NOT ILIKE '%Developer%' + AND + -- Error Handling + category NOT ILIKE '%Error%' + AND + -- File Locations + category NOT ILIKE '%File Locations%' + AND + -- Lock Management + category NOT ILIKE '%Lock%' + AND + -- Reporting and Logging / What to Log + -- broader '%Log%' pulls in WAL settings which we don't want here + category NOT ILIKE '%Logging%' + AND + -- Resource Usage / Memory + category NOT ILIKE '%Memory%' + AND + -- Preset Options + category NOT ILIKE '%Preset Options%' + AND + -- Query Tuning / Planner Method Configuration + -- Query Tuning / Planner Cost Constants + -- Query Tuning / Other Planner Options + -- Query Tuning / Genetic Query Optimizer + -- Statistics / Query and Index Statistics Collector + -- + -- more general to pull in 'track_activities' from category 'Statistics / Query and Index Statistics Collector' + --category NOT ILIKE '%Query Tuning%' + category NOT ILIKE '%Query%' + AND + -- Replication / Standby Servers + -- Replication / Sending Servers + -- Replication / Master Server + -- Replication / Subscribers + -- Replication + category NOT ILIKE '%Replication%' + AND + -- Resource Usage / Memory + -- Resource Usage / Asynchronous Behavior + -- Resource Usage / Cost-Based Vacuum Delay + -- Resource Usage / Background Writer + -- Resource Usage / Disk + -- Resource Usage / Kernel Resources + category NOT ILIKE '%Resource%' + AND + name NOT ILIKE '%ssl%' + AND + -- Connections and Authentication / SSL + category NOT ILIKE '%SSL%' + AND + short_desc NOT ILIKE '%SSL%' + AND + -- Statistics / Query and Index Statistics Collector + -- Statistics / Monitoring + category NOT ILIKE '%Statistics%' + AND + -- Write-Ahead Log / Settings + -- Write-Ahead Log / Recovery Target + -- Write-Ahead Log / Checkpoints + -- Write-Ahead Log / Archive Recovery + -- Write-Ahead Log / Archiving + category NOT ILIKE '%Write-Ahead Log%' ; From d3ca5b7f5745cb6a607b4449f5cadbf55ef316b6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:11 +0300 Subject: [PATCH 285/402] updated postgres_settings_preset.sql --- postgres_settings_preset.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/postgres_settings_preset.sql b/postgres_settings_preset.sql index bc20e3f..85eda5a 100644 --- a/postgres_settings_preset.sql +++ b/postgres_settings_preset.sql @@ -24,21 +24,21 @@ -- https://www.postgresql.org/docs/12/runtime-config-preset.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Preset Options - category ILIKE '%Preset Options%'; + -- Preset Options + category ILIKE '%Preset Options%'; From 2cde4213b94901c28596c4ea225d0f0e6642db7d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:14 +0300 Subject: [PATCH 286/402] updated postgres_settings_query_planning.sql --- postgres_settings_query_planning.sql | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/postgres_settings_query_planning.sql b/postgres_settings_query_planning.sql index f9dba57..2b2c75e 100644 --- a/postgres_settings_query_planning.sql +++ b/postgres_settings_query_planning.sql @@ -24,28 +24,28 @@ -- https://www.postgresql.org/docs/12/runtime-config-query.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Query Tuning / Planner Method Configuration - -- Query Tuning / Planner Cost Constants - -- Query Tuning / Other Planner Options - -- Query Tuning / Genetic Query Optimizer - -- Statistics / Query and Index Statistics Collector - -- - -- more general to pull in 'track_activities' from category 'Statistics / Query and Index Statistics Collector' - --category ILIKE '%Query Tuning%'; - category ILIKE '%Query%'; + -- Query Tuning / Planner Method Configuration + -- Query Tuning / Planner Cost Constants + -- Query Tuning / Other Planner Options + -- Query Tuning / Genetic Query Optimizer + -- Statistics / Query and Index Statistics Collector + -- + -- more general to pull in 'track_activities' from category 'Statistics / Query and Index Statistics Collector' + --category ILIKE '%Query Tuning%'; + category ILIKE '%Query%'; From b5da2f108528ab39422787bb2be6c69e1bba0480 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:16 +0300 Subject: [PATCH 287/402] updated postgres_settings_replication.sql --- postgres_settings_replication.sql | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/postgres_settings_replication.sql b/postgres_settings_replication.sql index 617e270..6099c23 100644 --- a/postgres_settings_replication.sql +++ b/postgres_settings_replication.sql @@ -24,25 +24,25 @@ -- https://www.postgresql.org/docs/12/runtime-config-replication.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Replication / Standby Servers - -- Replication / Sending Servers - -- Replication / Master Server - -- Replication / Subscribers - -- Replication - category ILIKE '%Replication%'; + -- Replication / Standby Servers + -- Replication / Sending Servers + -- Replication / Master Server + -- Replication / Subscribers + -- Replication + category ILIKE '%Replication%'; From 0db49c17d3117d5fea78720a0d4cdf9468304e92 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:18 +0300 Subject: [PATCH 288/402] updated postgres_settings_resources.sql --- postgres_settings_resources.sql | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/postgres_settings_resources.sql b/postgres_settings_resources.sql index 7dfff35..8376429 100644 --- a/postgres_settings_resources.sql +++ b/postgres_settings_resources.sql @@ -24,26 +24,26 @@ -- https://www.postgresql.org/docs/12/runtime-config-resource.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Resource Usage / Memory - -- Resource Usage / Asynchronous Behavior - -- Resource Usage / Cost-Based Vacuum Delay - -- Resource Usage / Background Writer - -- Resource Usage / Disk - -- Resource Usage / Kernel Resources - category ILIKE '%Resource%'; + -- Resource Usage / Memory + -- Resource Usage / Asynchronous Behavior + -- Resource Usage / Cost-Based Vacuum Delay + -- Resource Usage / Background Writer + -- Resource Usage / Disk + -- Resource Usage / Kernel Resources + category ILIKE '%Resource%'; From ab170adbc517c330a1081867299b03aa05f9acf6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:21 +0300 Subject: [PATCH 289/402] updated postgres_settings_ssl.sql --- postgres_settings_ssl.sql | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_settings_ssl.sql b/postgres_settings_ssl.sql index 83f89db..768579e 100644 --- a/postgres_settings_ssl.sql +++ b/postgres_settings_ssl.sql @@ -24,22 +24,22 @@ -- https://www.postgresql.org/docs/12/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SSL SELECT - name, - setting, - -- category - vartype, - short_desc, - enumvals, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category + vartype, + short_desc, + enumvals, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - name ILIKE '%ssl%' - OR - -- Connections and Authentication / SSL - category ILIKE '%SSL%' - OR - short_desc ILIKE '%SSL%'; + name ILIKE '%ssl%' + OR + -- Connections and Authentication / SSL + category ILIKE '%SSL%' + OR + short_desc ILIKE '%SSL%'; From 1fb5338167ff552fe43ac2f38b222b5877f63b22 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:23 +0300 Subject: [PATCH 290/402] updated postgres_settings_statistics.sql --- postgres_settings_statistics.sql | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/postgres_settings_statistics.sql b/postgres_settings_statistics.sql index 542ad11..4ad4205 100644 --- a/postgres_settings_statistics.sql +++ b/postgres_settings_statistics.sql @@ -24,22 +24,22 @@ -- https://www.postgresql.org/docs/12/runtime-config-statistics.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Statistics / Query and Index Statistics Collector - -- Statistics / Monitoring - category ILIKE '%Statistics%'; + -- Statistics / Query and Index Statistics Collector + -- Statistics / Monitoring + category ILIKE '%Statistics%'; From 03d68a190acf5360bffe1371fe2dec9fd43f7654 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:25 +0300 Subject: [PATCH 291/402] updated postgres_settings_wal.sql --- postgres_settings_wal.sql | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/postgres_settings_wal.sql b/postgres_settings_wal.sql index 0ecea9a..d93a258 100644 --- a/postgres_settings_wal.sql +++ b/postgres_settings_wal.sql @@ -24,25 +24,25 @@ -- https://www.postgresql.org/docs/12/runtime-config-wal.html SELECT - name, - setting, - -- category, - vartype, - short_desc, - -- enumvals, - source, - min_val, - max_val, - boot_val, - reset_val, - -- not available on PostgreSQL < 9.5 - pending_restart + name, + setting, + -- category, + vartype, + short_desc, + -- enumvals, + source, + min_val, + max_val, + boot_val, + reset_val, + -- not available on PostgreSQL < 9.5 + pending_restart FROM - pg_settings + pg_settings WHERE - -- Write-Ahead Log / Settings - -- Write-Ahead Log / Recovery Target - -- Write-Ahead Log / Checkpoints - -- Write-Ahead Log / Archive Recovery - -- Write-Ahead Log / Archiving - category ILIKE '%Write-Ahead Log%'; + -- Write-Ahead Log / Settings + -- Write-Ahead Log / Recovery Target + -- Write-Ahead Log / Checkpoints + -- Write-Ahead Log / Archive Recovery + -- Write-Ahead Log / Archiving + category ILIKE '%Write-Ahead Log%'; From 7e300383bb6309e4976fbf18183e9f28cba321cd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:34 +0300 Subject: [PATCH 292/402] updated postgres_tables_by_size.sql --- postgres_tables_by_size.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/postgres_tables_by_size.sql b/postgres_tables_by_size.sql index dd0d129..0de65a3 100644 --- a/postgres_tables_by_size.sql +++ b/postgres_tables_by_size.sql @@ -18,19 +18,19 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - --nspname || '.' || relname AS relation, - nspname, - relname, - pg_size_pretty(pg_total_relation_size(C.oid)) AS total_size + --nspname || '.' || relname AS relation, + nspname, + relname, + pg_size_pretty(pg_total_relation_size(C.oid)) AS total_size FROM - pg_class C + pg_class C LEFT JOIN - pg_namespace N ON (N.oid = C.relnamespace) + pg_namespace N ON (N.oid = C.relnamespace) WHERE - nspname NOT IN ('pg_catalog', 'information_schema') - AND - C.relkind <> 'i' - AND - nspname !~ '^pg_toast' + nspname NOT IN ('pg_catalog', 'information_schema') + AND + C.relkind <> 'i' + AND + nspname !~ '^pg_toast' ORDER BY - pg_total_relation_size(C.oid) DESC; + pg_total_relation_size(C.oid) DESC; From 710e7eb5e99f6b48db5f53bb3237a7419dd97dac Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:37 +0300 Subject: [PATCH 293/402] updated postgres_tables_by_size_2.sql --- postgres_tables_by_size_2.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/postgres_tables_by_size_2.sql b/postgres_tables_by_size_2.sql index 6bd10ae..6768cbd 100644 --- a/postgres_tables_by_size_2.sql +++ b/postgres_tables_by_size_2.sql @@ -18,13 +18,13 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname AS table_schema, - relname AS TABLE_NAME, - pg_size_pretty(pg_total_relation_size(relid)) AS total_size, - pg_size_pretty(pg_relation_size(relid)) AS data_size, - pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS external_size + schemaname AS table_schema, + relname AS TABLE_NAME, + pg_size_pretty(pg_total_relation_size(relid)) AS total_size, + pg_size_pretty(pg_relation_size(relid)) AS data_size, + pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS external_size FROM - pg_catalog.pg_statio_user_tables + pg_catalog.pg_statio_user_tables ORDER BY - pg_total_relation_size(relid) DESC, - pg_relation_size(relid) DESC; + pg_total_relation_size(relid) DESC, + pg_relation_size(relid) DESC; From 1721e9a0751727abb1b879e4e114b43f29b2dca0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:47 +0300 Subject: [PATCH 294/402] updated postgres_tables_cache_hit_ratio.sql --- postgres_tables_cache_hit_ratio.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/postgres_tables_cache_hit_ratio.sql b/postgres_tables_cache_hit_ratio.sql index 54468b3..e4cb54c 100644 --- a/postgres_tables_cache_hit_ratio.sql +++ b/postgres_tables_cache_hit_ratio.sql @@ -22,10 +22,10 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - SUM(heap_blks_read) AS heap_blks_read, - SUM(heap_blks_hit) AS heap_blks_hit, - SUM(heap_blks_hit) / - GREATEST(SUM(heap_blks_hit) + SUM(heap_blks_read), 1)::float - AS ratio + SUM(heap_blks_read) AS heap_blks_read, + SUM(heap_blks_hit) AS heap_blks_hit, + SUM(heap_blks_hit) / + GREATEST(SUM(heap_blks_hit) + SUM(heap_blks_read), 1)::float + AS ratio FROM - pg_statio_user_tables; + pg_statio_user_tables; From 7e7848bd7c2c1e6f79c318d3baf7fa83181082e2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:50:52 +0300 Subject: [PATCH 295/402] updated postgres_tables_index_usage.sql --- postgres_tables_index_usage.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/postgres_tables_index_usage.sql b/postgres_tables_index_usage.sql index 631f8d7..edd432c 100644 --- a/postgres_tables_index_usage.sql +++ b/postgres_tables_index_usage.sql @@ -20,13 +20,13 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - relname AS table, - 100 * idx_scan / GREATEST(seq_scan + idx_scan, 1) AS percent_of_times_index_used, - n_live_tup AS rows_in_table + relname AS table, + 100 * idx_scan / GREATEST(seq_scan + idx_scan, 1) AS percent_of_times_index_used, + n_live_tup AS rows_in_table FROM - pg_stat_user_tables + pg_stat_user_tables WHERE - seq_scan + idx_scan > 0 + seq_scan + idx_scan > 0 ORDER BY - rows_in_table DESC, - percent_of_times_index_used DESC; + rows_in_table DESC, + percent_of_times_index_used DESC; From 304fdc182ab561d835d05143a03c6dc1d97835b0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:51:00 +0300 Subject: [PATCH 296/402] updated postgres_tables_row_estimates.sql --- postgres_tables_row_estimates.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/postgres_tables_row_estimates.sql b/postgres_tables_row_estimates.sql index e7007a6..9973773 100644 --- a/postgres_tables_row_estimates.sql +++ b/postgres_tables_row_estimates.sql @@ -21,11 +21,11 @@ -- Tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.0 SELECT - schemaname, - relname, - n_live_tup + schemaname, + relname, + n_live_tup FROM - --pg_stat_all_tables - pg_stat_user_tables + --pg_stat_all_tables + pg_stat_user_tables ORDER BY - n_live_tup DESC; + n_live_tup DESC; From 6e8caf3da55cf24e77c71ada550777775a673d68 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:51:02 +0300 Subject: [PATCH 297/402] updated bigquery_ecommerce_conversion_rate.sql --- .../bigquery_ecommerce_conversion_rate.sql | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/analytics/bigquery_ecommerce_conversion_rate.sql b/analytics/bigquery_ecommerce_conversion_rate.sql index 5d516ef..4f7cfe8 100644 --- a/analytics/bigquery_ecommerce_conversion_rate.sql +++ b/analytics/bigquery_ecommerce_conversion_rate.sql @@ -14,24 +14,24 @@ -- WITH visitors AS( - SELECT - COUNT(DISTINCT fullVisitorId) AS total_visitors - FROM `data-to-insights.ecommerce.web_analytics` + SELECT + COUNT(DISTINCT fullVisitorId) AS total_visitors + FROM `data-to-insights.ecommerce.web_analytics` ), purchasers AS( - SELECT - COUNT(DISTINCT fullVisitorId) AS total_purchasers - FROM `data-to-insights.ecommerce.web_analytics` - WHERE totals.transactions IS NOT NULL + SELECT + COUNT(DISTINCT fullVisitorId) AS total_purchasers + FROM `data-to-insights.ecommerce.web_analytics` + WHERE totals.transactions IS NOT NULL ) SELECT - total_visitors, - total_purchasers, - total_purchasers / total_visitors AS conversion_rate, - ROUND(total_purchasers / total_visitors * 100, 2) AS conversion_percentage + total_visitors, + total_purchasers, + total_purchasers / total_visitors AS conversion_rate, + ROUND(total_purchasers / total_visitors * 100, 2) AS conversion_percentage FROM - visitors, - purchasers + visitors, + purchasers ; From 2b4fe5740c6f6ca491bf38d40ca663c9fd6532d4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:51:04 +0300 Subject: [PATCH 298/402] updated bigquery_ecommerce_purchasers_on_return_visit.sql --- ...y_ecommerce_purchasers_on_return_visit.sql | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql index 1bba7ab..f0a4866 100644 --- a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql +++ b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql @@ -16,22 +16,22 @@ -- visitors who bought on a return visit (could have bought on first as well) WITH all_visitor_stats AS ( SELECT - fullvisitorid, - IF( - COUNTIF(totals.transactions > 0 - AND - totals.newVisits IS NULL) > 0, 1, 0 - ) AS will_buy_on_return_visit - FROM - `data-to-insights.ecommerce.web_analytics` - GROUP BY - fullvisitorid + fullvisitorid, + IF( + COUNTIF(totals.transactions > 0 + AND + totals.newVisits IS NULL) > 0, 1, 0 + ) AS will_buy_on_return_visit + FROM + `data-to-insights.ecommerce.web_analytics` + GROUP BY + fullvisitorid ) SELECT - COUNT(DISTINCT fullvisitorid) AS total_visitors, - will_buy_on_return_visit + COUNT(DISTINCT fullvisitorid) AS total_visitors, + will_buy_on_return_visit FROM - all_visitor_stats + all_visitor_stats GROUP BY - will_buy_on_return_visit; + will_buy_on_return_visit; From fecda770bfb36bcb53ec758a456c42be8b5d3df5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:51:25 +0300 Subject: [PATCH 299/402] updated bigquery_ecommerce_purchasers_on_return_visit.sql --- ...bigquery_ecommerce_purchasers_on_return_visit.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql index f0a4866..953db5a 100644 --- a/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql +++ b/analytics/bigquery_ecommerce_purchasers_on_return_visit.sql @@ -18,14 +18,14 @@ WITH all_visitor_stats AS ( SELECT fullvisitorid, IF( - COUNTIF(totals.transactions > 0 - AND - totals.newVisits IS NULL) > 0, 1, 0 - ) AS will_buy_on_return_visit + COUNTIF(totals.transactions > 0 + AND + totals.newVisits IS NULL) > 0, 1, 0 + ) AS will_buy_on_return_visit FROM - `data-to-insights.ecommerce.web_analytics` + `data-to-insights.ecommerce.web_analytics` GROUP BY - fullvisitorid + fullvisitorid ) SELECT From b9debed15cdf2cb83e4bd04ca0fc4ee7ad309738 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:52:02 +0300 Subject: [PATCH 300/402] updated bigquery_ecommerce_time_on_site.sql --- analytics/bigquery_ecommerce_time_on_site.sql | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/analytics/bigquery_ecommerce_time_on_site.sql b/analytics/bigquery_ecommerce_time_on_site.sql index 7a882f7..af4401f 100644 --- a/analytics/bigquery_ecommerce_time_on_site.sql +++ b/analytics/bigquery_ecommerce_time_on_site.sql @@ -16,32 +16,32 @@ -- looking at bounces and time on site are not good features for model training and prediction since of the top 10 customers by time on site only 1 purchased! SELECT - * EXCEPT(fullVisitorId) + * EXCEPT(fullVisitorId) FROM - # features - (SELECT - fullVisitorId, - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site - FROM - `data-to-insights.ecommerce.web_analytics` - WHERE - totals.newVisits = 1) - JOIN - (SELECT - fullvisitorid, - IF( - COUNTIF( - totals.transactions > 0 - AND - totals.newVisits IS NULL - ) > 0, 1, 0 - ) AS will_buy_on_return_visit - FROM - `data-to-insights.ecommerce.web_analytics` - GROUP BY fullvisitorid) - USING (fullVisitorId) + # features + (SELECT + fullVisitorId, + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site + FROM + `data-to-insights.ecommerce.web_analytics` + WHERE + totals.newVisits = 1) + JOIN + (SELECT + fullvisitorid, + IF( + COUNTIF( + totals.transactions > 0 + AND + totals.newVisits IS NULL + ) > 0, 1, 0 + ) AS will_buy_on_return_visit + FROM + `data-to-insights.ecommerce.web_analytics` + GROUP BY fullvisitorid) + USING (fullVisitorId) ORDER BY - time_on_site DESC + time_on_site DESC LIMIT 10; From f4bc9ff8664d803b0fd794db495f1164610b4403 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:52:07 +0300 Subject: [PATCH 301/402] updated bigquery_ecommerce_top_5_products.sql --- analytics/bigquery_ecommerce_top_5_products.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/analytics/bigquery_ecommerce_top_5_products.sql b/analytics/bigquery_ecommerce_top_5_products.sql index 4dbb54b..269bd5b 100644 --- a/analytics/bigquery_ecommerce_top_5_products.sql +++ b/analytics/bigquery_ecommerce_top_5_products.sql @@ -14,15 +14,15 @@ -- SELECT - p.v2ProductName, - p.v2ProductCategory, - SUM(p.productQuantity) AS units_sold, - ROUND(SUM(p.localProductRevenue/1000000),2) AS revenue + p.v2ProductName, + p.v2ProductCategory, + SUM(p.productQuantity) AS units_sold, + ROUND(SUM(p.localProductRevenue/1000000),2) AS revenue FROM - `data-to-insights.ecommerce.web_analytics`, + `data-to-insights.ecommerce.web_analytics`, UNNEST(hits) AS h, UNNEST(h.product) AS p GROUP BY 1, 2 ORDER BY - revenue DESC + revenue DESC LIMIT 5; From eaac4b82b8a42218616fd836fdc60254d4a9ee2a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:52:21 +0300 Subject: [PATCH 302/402] updated bigquery_ml_classification_logistic_regression_create_model1.sql --- ...tion_logistic_regression_create_model1.sql | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql index e24a978..a1da965 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model1.sql @@ -23,40 +23,40 @@ CREATE OR REPLACE MODEL `ecommerce.classification_model1` OPTIONS ( - model_type='logistic_reg', - labels = ['will_buy_on_return_visit'] + model_type='logistic_reg', + labels = ['will_buy_on_return_visit'] ) AS -- training data provided below via SELECT statement SELECT - * EXCEPT(fullVisitorId) + * EXCEPT(fullVisitorId) FROM - -- features - ( - SELECT - fullVisitorId, - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site - FROM - `data-to-insights.ecommerce.web_analytics` - WHERE - totals.newVisits = 1 - -- train on subset of the data so we can test on the rest of the data - AND date BETWEEN '20160801' AND '20170430' - ) - JOIN - ( - SELECT - fullvisitorid, - -- the label of answers to train on - IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit - FROM - `data-to-insights.ecommerce.web_analytics` - GROUP BY - fullvisitorid - ) - USING - (fullVisitorId) + -- features + ( + SELECT + fullVisitorId, + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site + FROM + `data-to-insights.ecommerce.web_analytics` + WHERE + totals.newVisits = 1 + -- train on subset of the data so we can test on the rest of the data + AND date BETWEEN '20160801' AND '20170430' + ) + JOIN + ( + SELECT + fullvisitorid, + -- the label of answers to train on + IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit + FROM + `data-to-insights.ecommerce.web_analytics` + GROUP BY + fullvisitorid + ) + USING + (fullVisitorId) ; From a4fa2c02fdc2bad04c4b36f14fe974d9dbf55682 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:53:23 +0300 Subject: [PATCH 303/402] updated bigquery_ml_classification_logistic_regression_create_model2.sql --- ...tion_logistic_regression_create_model2.sql | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql index 0b9b091..b7d75b3 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_create_model2.sql @@ -19,70 +19,70 @@ CREATE OR REPLACE MODEL `ecommerce.classification_model_2` OPTIONS ( - model_type='logistic_reg', - labels = ['will_buy_on_return_visit'] + model_type='logistic_reg', + labels = ['will_buy_on_return_visit'] ) AS -- training data provided below via SELECT statements WITH all_visitor_stats AS ( - SELECT - fullvisitorid, - IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit - FROM `data-to-insights.ecommerce.web_analytics` - GROUP BY fullvisitorid + SELECT + fullvisitorid, + IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit + FROM `data-to-insights.ecommerce.web_analytics` + GROUP BY fullvisitorid ) -- select features SELECT * EXCEPT(unique_session_id) FROM ( - SELECT - CONCAT(fullvisitorid, CAST(visitId AS STRING)) AS unique_session_id, - - -- labels - will_buy_on_return_visit, - - MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, - - -- behavior on the site - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site, - totals.pageviews, - - -- where the visitor came from - trafficSource.source, - trafficSource.medium, - channelGrouping, - - -- mobile or desktop - device.deviceCategory, - - -- geographic - IFNULL(geoNetwork.country, "") AS country - - FROM `data-to-insights.ecommerce.web_analytics`, - UNNEST(hits) AS h - - JOIN - all_visitor_stats - USING - (fullvisitorid) - - WHERE 1=1 - -- only predict for new visits - AND totals.newVisits = 1 - -- train on subset of the data so we can test on the rest of the data - AND date BETWEEN '20160801' AND '20170430' - - GROUP BY - unique_session_id, - will_buy_on_return_visit, - bounces, - time_on_site, - totals.pageviews, - trafficSource.source, - trafficSource.medium, - channelGrouping, - device.deviceCategory, - country + SELECT + CONCAT(fullvisitorid, CAST(visitId AS STRING)) AS unique_session_id, + + -- labels + will_buy_on_return_visit, + + MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, + + -- behavior on the site + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site, + totals.pageviews, + + -- where the visitor came from + trafficSource.source, + trafficSource.medium, + channelGrouping, + + -- mobile or desktop + device.deviceCategory, + + -- geographic + IFNULL(geoNetwork.country, "") AS country + + FROM `data-to-insights.ecommerce.web_analytics`, + UNNEST(hits) AS h + + JOIN + all_visitor_stats + USING + (fullvisitorid) + + WHERE 1=1 + -- only predict for new visits + AND totals.newVisits = 1 + -- train on subset of the data so we can test on the rest of the data + AND date BETWEEN '20160801' AND '20170430' + + GROUP BY + unique_session_id, + will_buy_on_return_visit, + bounces, + time_on_site, + totals.pageviews, + trafficSource.source, + trafficSource.medium, + channelGrouping, + device.deviceCategory, + country ); From 5885000831077381d9c2fec2c4d045f0906d4b07 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:54:54 +0300 Subject: [PATCH 304/402] updated bigquery_ml_classification_logistic_regression_evaluate_model1.sql --- ...on_logistic_regression_evaluate_model1.sql | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql index 8b41367..8f5bb7f 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model1.sql @@ -20,48 +20,48 @@ -- poor ROC auc only ~ 0.7x score - go to model 2 SELECT - roc_auc, - CASE - WHEN roc_auc > .9 THEN 'good' - WHEN roc_auc > .8 THEN 'fair' - WHEN roc_auc > .7 THEN 'not great' - ELSE 'poor' END AS model_quality, - accuracy, - precision, - recall + roc_auc, + CASE + WHEN roc_auc > .9 THEN 'good' + WHEN roc_auc > .8 THEN 'fair' + WHEN roc_auc > .7 THEN 'not great' + ELSE 'poor' END AS model_quality, + accuracy, + precision, + recall FROM - ML.EVALUATE( - MODEL ecommerce.classification_model1, ( + ML.EVALUATE( + MODEL ecommerce.classification_model1, ( - -- the test data is supplied below via a SELECT query for the model to compare its predictions to (notice this is non-overlapping with the training data) + -- the test data is supplied below via a SELECT query for the model to compare its predictions to (notice this is non-overlapping with the training data) - SELECT - * EXCEPT(fullVisitorId) - FROM - - -- features - ( SELECT - fullVisitorId, - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site + * EXCEPT(fullVisitorId) FROM - `data-to-insights.ecommerce.web_analytics` - WHERE - totals.newVisits = 1 - -- notice this time period doesn't overlap with the training data - AND date BETWEEN '20170501' AND '20170630' - ) - JOIN - ( - SELECT - fullvisitorid, - IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit - FROM - `data-to-insights.ecommerce.web_analytics` - GROUP BY - fullvisitorid + + -- features + ( + SELECT + fullVisitorId, + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site + FROM + `data-to-insights.ecommerce.web_analytics` + WHERE + totals.newVisits = 1 + -- notice this time period doesn't overlap with the training data + AND date BETWEEN '20170501' AND '20170630' + ) + JOIN + ( + SELECT + fullvisitorid, + IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit + FROM + `data-to-insights.ecommerce.web_analytics` + GROUP BY + fullvisitorid + ) + USING (fullVisitorId) ) - USING (fullVisitorId) - ) - ); + ); From 1c66587296cf334dc965ca93d661c15a109a80f4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 14:57:47 +0300 Subject: [PATCH 305/402] updated bigquery_ml_classification_logistic_regression_evaluate_model2.sql --- ...on_logistic_regression_evaluate_model2.sql | 132 +++++++++--------- 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql index bd16be6..15c2022 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_evaluate_model2.sql @@ -20,73 +20,77 @@ -- good ROC auc > 0.9 - gives much better predictive power than model1 SELECT - roc_auc, - CASE - WHEN roc_auc > .9 THEN 'good' - WHEN roc_auc > .8 THEN 'fair' - WHEN roc_auc > .7 THEN 'not great' - ELSE 'poor' END AS model_quality, - accuracy, - precision, - recall + roc_auc, + CASE + WHEN roc_auc > .9 THEN 'good' + WHEN roc_auc > .8 THEN 'fair' + WHEN roc_auc > .7 THEN 'not great' + ELSE 'poor' END AS model_quality, + accuracy, + precision, + recall FROM - ML.EVALUATE(MODEL ecommerce.classification_model_2, ( + ML.EVALUATE(MODEL ecommerce.classification_model_2, ( -WITH all_visitor_stats AS ( -SELECT - fullvisitorid, - IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit - FROM `data-to-insights.ecommerce.web_analytics` - GROUP BY fullvisitorid -) + WITH all_visitor_stats AS ( + SELECT + fullvisitorid, + IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit + FROM `data-to-insights.ecommerce.web_analytics` + GROUP BY fullvisitorid + ) # add in new features SELECT * EXCEPT(unique_session_id) FROM ( - SELECT - CONCAT(fullvisitorid, CAST(visitId AS STRING)) AS unique_session_id, - - # labels - will_buy_on_return_visit, - - MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, - - # behavior on the site - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site, - totals.pageviews, - - # where the visitor came from - trafficSource.source, - trafficSource.medium, - channelGrouping, - - # mobile or desktop - device.deviceCategory, - - # geographic - IFNULL(geoNetwork.country, "") AS country - - FROM `data-to-insights.ecommerce.web_analytics`, - UNNEST(hits) AS h - - JOIN all_visitor_stats USING(fullvisitorid) - - WHERE 1=1 - # only predict for new visits - AND totals.newVisits = 1 - AND date BETWEEN '20170501' AND '20170630' # eval 2 months - - GROUP BY - unique_session_id, - will_buy_on_return_visit, - bounces, - time_on_site, - totals.pageviews, - trafficSource.source, - trafficSource.medium, - channelGrouping, - device.deviceCategory, - country -) -)); + SELECT + CONCAT(fullvisitorid, CAST(visitId AS STRING)) AS unique_session_id, + + # labels + will_buy_on_return_visit, + + MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, + + # behavior on the site + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site, + totals.pageviews, + + # where the visitor came from + trafficSource.source, + trafficSource.medium, + channelGrouping, + + # mobile or desktop + device.deviceCategory, + + # geographic + IFNULL(geoNetwork.country, "") AS country + + FROM `data-to-insights.ecommerce.web_analytics`, + UNNEST(hits) AS h + + JOIN + all_visitor_stats + + USING(fullvisitorid) + + WHERE 1=1 + # only predict for new visits + AND totals.newVisits = 1 + AND date BETWEEN '20170501' AND '20170630' # eval 2 months + + GROUP BY + unique_session_id, + will_buy_on_return_visit, + bounces, + time_on_site, + totals.pageviews, + trafficSource.source, + trafficSource.medium, + channelGrouping, + device.deviceCategory, + country + ) + ) +); From a5db059190da0f4ff031432b6749af2ea9281f7b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 15:01:26 +0300 Subject: [PATCH 306/402] updated bigquery_ml_classification_logistic_regression_predict_with_model2.sql --- ...ogistic_regression_predict_with_model2.sql | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql index 8e39cf6..fa36f31 100644 --- a/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql +++ b/analytics/bigquery_ml_classification_logistic_regression_predict_with_model2.sql @@ -16,72 +16,72 @@ -- use the improved model 2 to predict which users will buy on return visit SELECT - * + * FROM - ml.PREDICT( - MODEL `ecommerce.classification_model_2`, ( + ml.PREDICT( + MODEL `ecommerce.classification_model_2`, ( - WITH all_visitor_stats AS ( - SELECT - fullvisitorid, - IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit - FROM `data-to-insights.ecommerce.web_analytics` - GROUP BY fullvisitorid - ) + WITH all_visitor_stats AS ( + SELECT + fullvisitorid, + IF(COUNTIF(totals.transactions > 0 AND totals.newVisits IS NULL) > 0, 1, 0) AS will_buy_on_return_visit + FROM `data-to-insights.ecommerce.web_analytics` + GROUP BY fullvisitorid + ) - SELECT - CONCAT(fullvisitorid, '-',CAST(visitId AS STRING)) AS unique_session_id, + SELECT + CONCAT(fullvisitorid, '-',CAST(visitId AS STRING)) AS unique_session_id, - -- labels - will_buy_on_return_visit, + -- labels + will_buy_on_return_visit, - MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, + MAX(CAST(h.eCommerceAction.action_type AS INT64)) AS latest_ecommerce_progress, - -- behavior on the site - IFNULL(totals.bounces, 0) AS bounces, - IFNULL(totals.timeOnSite, 0) AS time_on_site, - totals.pageviews, + -- behavior on the site + IFNULL(totals.bounces, 0) AS bounces, + IFNULL(totals.timeOnSite, 0) AS time_on_site, + totals.pageviews, - -- where the visitor came from - trafficSource.source, - trafficSource.medium, - channelGrouping, + -- where the visitor came from + trafficSource.source, + trafficSource.medium, + channelGrouping, - -- mobile or desktop - device.deviceCategory, + -- mobile or desktop + device.deviceCategory, - -- geographic - IFNULL(geoNetwork.country, "") AS country + -- geographic + IFNULL(geoNetwork.country, "") AS country - FROM - `data-to-insights.ecommerce.web_analytics`, - UNNEST(hits) AS h + FROM + `data-to-insights.ecommerce.web_analytics`, + UNNEST(hits) AS h - JOIN - all_visitor_stats - USING - (fullvisitorid) + JOIN + all_visitor_stats + USING + (fullvisitorid) - WHERE - -- only predict for new visits - totals.newVisits = 1 - -- test on a non-overlapping subset to the training data - AND date BETWEEN '20170701' AND '20170801' + WHERE + -- only predict for new visits + totals.newVisits = 1 + -- test on a non-overlapping subset to the training data + AND date BETWEEN '20170701' AND '20170801' - GROUP BY - unique_session_id, - will_buy_on_return_visit, - bounces, - time_on_site, - totals.pageviews, - trafficSource.source, - trafficSource.medium, - channelGrouping, - device.deviceCategory, - country + GROUP BY + unique_session_id, + will_buy_on_return_visit, + bounces, + time_on_site, + totals.pageviews, + trafficSource.source, + trafficSource.medium, + channelGrouping, + device.deviceCategory, + country + ) ) - ) ORDER BY - -- your label name will be prefixed with 'predicted_' for the field generated by the model - predicted_will_buy_on_return_visit DESC; + -- your label name will be prefixed with 'predicted_' for the field generated by the model + predicted_will_buy_on_return_visit DESC; From bd1226ee6457998cf0bed84fb277345057fb4f34 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 10 Oct 2024 15:02:08 +0300 Subject: [PATCH 307/402] updated bigquery_info_biggest_public_tables_by_row_count.sql --- bigquery_info_biggest_public_tables_by_row_count.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery_info_biggest_public_tables_by_row_count.sql b/bigquery_info_biggest_public_tables_by_row_count.sql index f9b2332..2f04fe8 100644 --- a/bigquery_info_biggest_public_tables_by_row_count.sql +++ b/bigquery_info_biggest_public_tables_by_row_count.sql @@ -65,8 +65,8 @@ SELECT TIMESTAMP_MILLIS(creation_time) AS creation_time, TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, CASE - WHEN type = 1 THEN 'table' - WHEN type = 2 THEN 'view' + WHEN type = 1 THEN 'table' + WHEN type = 2 THEN 'view' ELSE NULL END AS type FROM From 0612a03029bb7f0af5c48c4deabdabc4823b4f9f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 02:55:50 +0300 Subject: [PATCH 308/402] added sqlfluff.yaml --- .github/workflows/sqlfluff.yaml | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/sqlfluff.yaml diff --git a/.github/workflows/sqlfluff.yaml b/.github/workflows/sqlfluff.yaml new file mode 100644 index 0000000..6f431ef --- /dev/null +++ b/.github/workflows/sqlfluff.yaml @@ -0,0 +1,60 @@ +# +# Author: Hari Sekhon +# Date: Tue Feb 4 09:53:28 2020 +0000 +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# S Q L F l u f f +# ============================================================================ # + +--- +name: SQL + +on: + push: + branches: + - master + - main + paths: + - '**/*.sql' + - .github/workflows/sqlfluff.yaml + pull_request: + branches: + - master + - main + paths: + - '**/*.sql' + - .github/workflows/sqlfluff.yaml + workflow_dispatch: + inputs: + debug: + type: boolean + required: false + default: false + schedule: + - cron: '0 0 * * 1' + +permissions: + contents: read + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + sqlfluff: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: SQLFluff + uses: HariSekhon/GitHub-Actions/.github/workflows/sqlfluff.yaml@master + with: + debug: ${{ github.event.inputs.debug }} From ba0c74dd08008da425c5bfd8473526945057c621 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 02:57:33 +0300 Subject: [PATCH 309/402] updated sqlfluff.yaml --- .github/workflows/sqlfluff.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sqlfluff.yaml b/.github/workflows/sqlfluff.yaml index 6f431ef..f8cf567 100644 --- a/.github/workflows/sqlfluff.yaml +++ b/.github/workflows/sqlfluff.yaml @@ -16,7 +16,7 @@ # ============================================================================ # --- -name: SQL +name: SQLFluff on: push: From 1371282bfe11ae345a69bd9fb37c46b3261da1ed Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:00:25 +0300 Subject: [PATCH 310/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fccdb59..ccf7b43 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) +[![Oracle](https://img.shields.io/badge/SQL-Oracle-#F80000?logo=oracle)](https://oracle.com/) [![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) From 7b5489b2303aa27bcae8cf520ad6565670a3fafe Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:16:01 +0300 Subject: [PATCH 311/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ccf7b43..8c53f77 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) -[![Oracle](https://img.shields.io/badge/SQL-Oracle-#F80000?logo=oracle)](https://oracle.com/) +[![Oracle](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.oracle.com/) [![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) From fbe8d6848b029b36f628d0d7fb609a60a93d47af Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:18:49 +0300 Subject: [PATCH 312/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c53f77..ef5c83a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) -[![Oracle](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.oracle.com/) +[![Oracle](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.oracle.com) [![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) From 0f5a2bd42d4226aec1000fa24b2f42a3eaae59b1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:20:02 +0300 Subject: [PATCH 313/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef5c83a..34562b1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) -[![Oracle](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.oracle.com) +[![Oracle](https://img.shields.io/badge/SQL-Oracle-F80000?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3JhY2xlPC90aXRsZT48cGF0aCBkPSJNMTYuNDEyIDQuNDEyaC04LjgyYTcuNTg4IDcuNTg4IDAgMCAwLS4wMDggMTUuMTc2aDguODI4YTcuNTg4IDcuNTg4IDAgMCAwIDAtMTUuMTc2em0tLjE5MyAxMi41MDJINy43ODZhNC45MTUgNC45MTUgMCAwIDEgMC05LjgyOGg4LjQzM2E0LjkxNCA0LjkxNCAwIDEgMSAwIDkuODI4eiIgZmlsbD0iI2ZmZmZmZiIgLz48L3N2Zz4K&logoColor=white)](https://oracle.com/) [![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) From 0db09ea4ac5942e60727193d5374c086839f03e7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:21:07 +0300 Subject: [PATCH 314/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34562b1..b75d297 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/) [![GitHub Last Commit](https://img.shields.io/github/last-commit/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/commits/master) -[![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql)](https://www.postgresql.org/) +[![PostgreSQL](https://img.shields.io/badge/SQL-PostreSQL-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/) [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) [![Oracle](https://img.shields.io/badge/SQL-Oracle-F80000?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3JhY2xlPC90aXRsZT48cGF0aCBkPSJNMTYuNDEyIDQuNDEyaC04LjgyYTcuNTg4IDcuNTg4IDAgMCAwLS4wMDggMTUuMTc2aDguODI4YTcuNTg4IDcuNTg4IDAgMCAwIDAtMTUuMTc2em0tLjE5MyAxMi41MDJINy43ODZhNC45MTUgNC45MTUgMCAwIDEgMC05LjgyOGg4LjQzM2E0LjkxNCA0LjkxNCAwIDEgMSAwIDkuODI4eiIgZmlsbD0iI2ZmZmZmZiIgLz48L3N2Zz4K&logoColor=white)](https://oracle.com/) From fcb0a772ed8d04ec908a63370844601a5d03c89e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:21:30 +0300 Subject: [PATCH 315/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b75d297..02a244c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ [![Oracle](https://img.shields.io/badge/SQL-Oracle-F80000?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3JhY2xlPC90aXRsZT48cGF0aCBkPSJNMTYuNDEyIDQuNDEyaC04LjgyYTcuNTg4IDcuNTg4IDAgMCAwLS4wMDggMTUuMTc2aDguODI4YTcuNTg4IDcuNTg4IDAgMCAwIDAtMTUuMTc2em0tLjE5MyAxMi41MDJINy43ODZhNC45MTUgNC45MTUgMCAwIDEgMC05LjgyOGg4LjQzM2E0LjkxNCA0LjkxNCAwIDEgMSAwIDkuODI4eiIgZmlsbD0iI2ZmZmZmZiIgLz48L3N2Zz4K&logoColor=white)](https://oracle.com/) [![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) -[![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud)](https://cloud.google.com/bigquery) +[![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud&logoColor=white)](https://cloud.google.com/bigquery) [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) From 6121df16715859c70801c1b9fa1f700bd3dbfa38 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:22:36 +0300 Subject: [PATCH 316/402] updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 02a244c..7a398a0 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ [![MySQL](https://img.shields.io/badge/SQL-MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/) [![MariaDB](https://img.shields.io/badge/SQL-MariaDB-003545?logo=mariadb)](https://mariadb.org/) [![Oracle](https://img.shields.io/badge/SQL-Oracle-F80000?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3JhY2xlPC90aXRsZT48cGF0aCBkPSJNMTYuNDEyIDQuNDEyaC04LjgyYTcuNTg4IDcuNTg4IDAgMCAwLS4wMDggMTUuMTc2aDguODI4YTcuNTg4IDcuNTg4IDAgMCAwIDAtMTUuMTc2em0tLjE5MyAxMi41MDJINy43ODZhNC45MTUgNC45MTUgMCAwIDEgMC05LjgyOGg4LjQzM2E0LjkxNCA0LjkxNCAwIDEgMSAwIDkuODI4eiIgZmlsbD0iI2ZmZmZmZiIgLz48L3N2Zz4K&logoColor=white)](https://oracle.com/) -[![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazon%20aws)](https://aws.amazon.com/athena/) -[![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazon%20aws)](https://aws.amazon.com/aurora/) +[![AWS Athena](https://img.shields.io/badge/SQL-AWS%20Athena-232F3E?logo=amazonwebservices)](https://aws.amazon.com/athena/) +[![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazonwebservices)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud&logoColor=white)](https://cloud.google.com/bigquery) [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) From d1dc2c313d9a3bf5f6b7c2944afa237b2c9c8ce0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:25:34 +0300 Subject: [PATCH 317/402] added oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 oracle_tablespace_space.sql diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql new file mode 100644 index 0000000..72c5434 --- /dev/null +++ b/oracle_tablespace_space.sql @@ -0,0 +1,16 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle From 562dc0e6ecb472a9b97ab7c1d2fc3b3b2cc741e4 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:28:10 +0300 Subject: [PATCH 318/402] added oracle_table_space.sql --- oracle_table_space.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 oracle_table_space.sql diff --git a/oracle_table_space.sql b/oracle_table_space.sql new file mode 100644 index 0000000..72c5434 --- /dev/null +++ b/oracle_table_space.sql @@ -0,0 +1,16 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle From 1ae200a7234df7c9067819c8054a9219c6ac18a5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:50:03 +0300 Subject: [PATCH 319/402] added oracle_show_dba_recyclebin.sql --- oracle_show_dba_recyclebin.sql | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 oracle_show_dba_recyclebin.sql diff --git a/oracle_show_dba_recyclebin.sql b/oracle_show_dba_recyclebin.sql new file mode 100644 index 0000000..7ac286e --- /dev/null +++ b/oracle_show_dba_recyclebin.sql @@ -0,0 +1,29 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:50:00 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show All Users Recyclebins via DBA Recyclebin + +SELECT + username, + original_name, + type, + drop_time, + is_parent, + recyclebin_namE +FROM + dba_recyclebin +ORDER BY + username, drop_time +DESC; From 2000ffe67a542e9cf2bdf125d96b83046380dd50 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:50:56 +0300 Subject: [PATCH 320/402] updated oracle_show_dba_recyclebin.sql --- oracle_show_dba_recyclebin.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_show_dba_recyclebin.sql b/oracle_show_dba_recyclebin.sql index 7ac286e..688d790 100644 --- a/oracle_show_dba_recyclebin.sql +++ b/oracle_show_dba_recyclebin.sql @@ -21,7 +21,7 @@ SELECT type, drop_time, is_parent, - recyclebin_namE + recyclebin_name FROM dba_recyclebin ORDER BY From 65fbb9d1f6c423be8fecf39d54af06a9afc15398 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:51:32 +0300 Subject: [PATCH 321/402] updated oracle_show_dba_recyclebin.sql --- oracle_show_dba_recyclebin.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oracle_show_dba_recyclebin.sql b/oracle_show_dba_recyclebin.sql index 688d790..b80371a 100644 --- a/oracle_show_dba_recyclebin.sql +++ b/oracle_show_dba_recyclebin.sql @@ -16,6 +16,8 @@ -- Oracle - Show All Users Recyclebins via DBA Recyclebin SELECT + --owner, + --object_name, username, original_name, type, @@ -25,5 +27,7 @@ SELECT FROM dba_recyclebin ORDER BY - username, drop_time + --owner, + username, + drop_time DESC; From 90fc8fab2f10106b1cd88b57c8b8f98048aab806 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 03:53:06 +0300 Subject: [PATCH 322/402] added oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 oracle_tablespace_space2.sql diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql new file mode 100644 index 0000000..72c5434 --- /dev/null +++ b/oracle_tablespace_space2.sql @@ -0,0 +1,16 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle From 09f4ac195aed2b8b4226c842255f88f04ca0cd6e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:03:02 +0300 Subject: [PATCH 323/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 72c5434..4f4239e 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -13,4 +13,27 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle +-- Oracle - Show Tablespace + +SELECT + df.tablespace_name "Tablespace", + df.bytes / (1024 * 1024) "Size (MB)", + (df.bytes - SUM(fs.bytes)) / (1024 * 1024) "Used (MB)", + SUM(fs.bytes) / (1024 * 1024) "Free (MB)", + ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free %" +FROM + dba_free_space fs, + (SELECT + tablespace_name, + SUM(bytes) bytes + FROM + dba_data_files + GROUP BY + tablespace_name) df +WHERE + fs.tablespace_name (+) = df.tablespace_name +GROUP BY + df.tablespace_name, + df.bytes +ORDER BY + "Free %"; From bd29586ac12ef7891cda6f63d961f814c48ca010 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:04:33 +0300 Subject: [PATCH 324/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 4f4239e..36da47c 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -17,9 +17,9 @@ SELECT df.tablespace_name "Tablespace", - df.bytes / (1024 * 1024) "Size (MB)", - (df.bytes - SUM(fs.bytes)) / (1024 * 1024) "Used (MB)", - SUM(fs.bytes) / (1024 * 1024) "Free (MB)", + df.bytes / (1024 * 1024 * 1024) "Size (GB)", + (df.bytes - SUM(fs.bytes)) / (1024 * 1024 * 1024) "Used (GB)", + SUM(fs.bytes) / (1024 * 1024 * 1024) "Free (GB)", ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free %" FROM dba_free_space fs, From b9ba9504e29351a7bef5d66f91f4588736ef17eb Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:05:24 +0300 Subject: [PATCH 325/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 36da47c..580e84e 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tablespace +-- Oracle - Show Tablespace Size, Space Used vs Free in GB and as a Percentage SELECT df.tablespace_name "Tablespace", From 21f07503ce870b26940f81ab7bc1a8b2f4ae69c6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:25:42 +0300 Subject: [PATCH 326/402] updated oracle_table_space.sql --- oracle_table_space.sql | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 72c5434..6981394 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -13,4 +13,32 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle +-- Oracle - Show Tables' Space Used vs Free and Percentage Percentage where they are at lease 20% utilized + +SELECT + owner, + table_name, + -- each block is 8KB, multiply it to GB, round to two decimal places + ROUND(blocks * 8 / 1024 / 1024, 2) AS total_gb, + -- estimate data size from rows vs average row size, round to two decimal places + ROUND(num_rows * avg_row_len / 1024 / 1024 / 1024, 2) AS actual_data_gb, + -- estimate free space by subtracting the two above calculations + ROUND((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024), 2) AS free_space_gb, + -- calculate free space percentage from the above three calculations + ROUND( + ( (blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024) ) / + (blocks * 8 / 1024 / 1024) * 100, 2) AS free_space_pct +FROM + dba_tables +WHERE + blocks > 0 + AND + num_rows > 0 + AND + ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / + (blocks * 8 / 1024 / 1024) > 0.2 + AND + owner <> 'SYS' +ORDER BY + free_space_mb DESC, + total_mb DESC; From f61db2931915eda369c031243a9f97dc13aaba54 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:34:05 +0300 Subject: [PATCH 327/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 580e84e..8b8be15 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -18,9 +18,9 @@ SELECT df.tablespace_name "Tablespace", df.bytes / (1024 * 1024 * 1024) "Size (GB)", - (df.bytes - SUM(fs.bytes)) / (1024 * 1024 * 1024) "Used (GB)", - SUM(fs.bytes) / (1024 * 1024 * 1024) "Free (GB)", - ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free %" + (df.bytes - SUM(fs.bytes)) / (1024 * 1024 * 1024) "Used Space (GB)", + SUM(fs.bytes) / (1024 * 1024 * 1024) "Free Space (GB)", + ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free Space %" FROM dba_free_space fs, (SELECT @@ -36,4 +36,5 @@ GROUP BY df.tablespace_name, df.bytes ORDER BY - "Free %"; + "Free %" +ASC; From 3c94cf7501665e25babbdb665e8b60705bcb32bd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:34:14 +0300 Subject: [PATCH 328/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index 72c5434..224d107 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -13,4 +13,17 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle +-- Oracle - Show Tablespace Size, Space Used vs Free in GB and as a Percentage + +SELECT + tablespace_name "Tablespace", + -- convert used_space in blocks to GB as each block is 8KB + ROUND(used_space * 8 / 1024 / 1024, 2) AS "Used Space (GB)", + -- convert tablespace_size in blocks to GB as each block is 8KB + ROUND(tablespace_size * 8 / 1024 / 1024, 2) AS "Total Space (GB)", + ROUND(used_percent, 2) AS "Used Space %" +FROM + dba_tablespace_usage_metrics +ORDER BY + "Used %" +DESC; From 43bedf260bcee350a089fb4a3438e200139e7c63 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:34:33 +0300 Subject: [PATCH 329/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index 224d107..63bc6ab 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tablespace Size, Space Used vs Free in GB and as a Percentage +-- Oracle - Show Tablespace Size, Space Used vs Free in GB and Percentage Used SELECT tablespace_name "Tablespace", From a60e3d850ec069f8bfcc31f71cbcfe19a09d4a38 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 04:35:25 +0300 Subject: [PATCH 330/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index 63bc6ab..dae2ecf 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tablespace Size, Space Used vs Free in GB and Percentage Used +-- Oracle - Show Tablespace Size, Space Used GB and Percentage Used SELECT tablespace_name "Tablespace", From 1b2e41006b666437f10ff5397f48d653196774a8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 05:55:25 +0300 Subject: [PATCH 331/402] updated oracle_checkpoints.sql --- oracle_checkpoints.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql index ae1e768..3f468c7 100644 --- a/oracle_checkpoints.sql +++ b/oracle_checkpoints.sql @@ -17,7 +17,7 @@ SELECT NAME, - checkpoint_time, + checkpoint_time FROM v$datafile ORDER BY From a97490a7e9a426e274f01afd691bd656e7a9a424 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 17:51:15 +0300 Subject: [PATCH 332/402] added markdown.yaml --- .github/workflows/markdown.yaml | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/markdown.yaml diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml new file mode 100644 index 0000000..a15b157 --- /dev/null +++ b/.github/workflows/markdown.yaml @@ -0,0 +1,54 @@ +# +# Author: Hari Sekhon +# Date: 2023-04-14 23:53:43 +0100 (Fri, 14 Apr 2023) +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# M a r k D o w n +# ============================================================================ # + +--- +name: Markdown + +on: + push: + branches: + - master + - main + paths: + - '**/*.md' + - .mdlrc + - .mdl.rb + - .markdownlint.rb + - .github/workflows/markdown.yaml + pull_request: + branches: + - master + - main + paths: + - '**/*.md' + - .mdlrc + - .mdl.rb + - .markdownlint.rb + - .github/workflows/markdown.yaml + workflow_dispatch: + +permissions: + contents: read + pull-requests: read + +jobs: + Markdown: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: Markdown + uses: HariSekhon/GitHub-Actions/.github/workflows/markdown.yaml@master From d646a389f782edc3d91ad5ff59f8a4f28d78b0aa Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2024 18:00:03 +0300 Subject: [PATCH 333/402] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7a398a0..ea948e8 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![YAML](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml) +[![Markdown](https://github.com/HariSekhon/SQL-scripts/actions/workflows/markdown.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/markdown.yaml) [![Validation](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/validate.yaml) [![Grype](https://github.com/HariSekhon/SQL-scripts/actions/workflows/grype.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/grype.yaml) [![Kics](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/kics.yaml) From 1551ae4f36f57fbe395f7c3f5570cb920a20c5b9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:51:38 +0300 Subject: [PATCH 334/402] updated oracle_checkpoints.sql --- oracle_checkpoints.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql index 3f468c7..f8fc992 100644 --- a/oracle_checkpoints.sql +++ b/oracle_checkpoints.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle Show Checkpoints on DBF data files (relevant for DBA recoveries) +-- +-- Tested in late 2000s on Oracle 9i, 10g, 11g and 2024 on Oracle 19c SELECT NAME, From 8756ff798d7be6bf1177776179742ac0100caf5e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:53:27 +0300 Subject: [PATCH 335/402] updated oracle_datafiles_checkpoint_change.sql --- oracle_datafiles_checkpoint_change.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_change.sql b/oracle_datafiles_checkpoint_change.sql index 8431f78..c097cc6 100644 --- a/oracle_datafiles_checkpoint_change.sql +++ b/oracle_datafiles_checkpoint_change.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle Show the Checkpoints on the DBF data files (important for DBA recoveries) +-- +-- Tested in late 2000s on Oracle 9i, 10g, 11g and in 2024 on Oracle 19c SELECT checkpoint_change#, From 09ba1155c1a8db6b0749f0b32265fe5c475343a3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:54:43 +0300 Subject: [PATCH 336/402] updated oracle_datafiles_checkpoint_time.sql --- oracle_datafiles_checkpoint_time.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_time.sql b/oracle_datafiles_checkpoint_time.sql index e1b7eb6..c524e71 100644 --- a/oracle_datafiles_checkpoint_time.sql +++ b/oracle_datafiles_checkpoint_time.sql @@ -13,7 +13,10 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle Show Checkpoint Dates on DBF data files (relevant for DBA recoveries) +-- +-- Tested in late 2000s on Oracle 9i, 10g, 11g and 2024 on Oracle 19c + SELECT checkpoint_time, From 2d5453c97176ae940363fe2f06c531b08998aff6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:55:55 +0300 Subject: [PATCH 337/402] updated oracle_datafiles_lastchanged.sql --- oracle_datafiles_lastchanged.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_datafiles_lastchanged.sql b/oracle_datafiles_lastchanged.sql index 2cb246a..b2816a5 100644 --- a/oracle_datafiles_lastchanged.sql +++ b/oracle_datafiles_lastchanged.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle Show the system change number (SCN) +-- +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT last_change#, From c1135b5c1ec64fc6aa1dd07699e5500929a1ce52 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:56:03 +0300 Subject: [PATCH 338/402] updated oracle_datafiles_checkpoint_time.sql --- oracle_datafiles_checkpoint_time.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_time.sql b/oracle_datafiles_checkpoint_time.sql index c524e71..5e7cbdc 100644 --- a/oracle_datafiles_checkpoint_time.sql +++ b/oracle_datafiles_checkpoint_time.sql @@ -15,7 +15,7 @@ -- Oracle Show Checkpoint Dates on DBF data files (relevant for DBA recoveries) -- --- Tested in late 2000s on Oracle 9i, 10g, 11g and 2024 on Oracle 19c +-- Tested on Oracle 9i, 10g, 11g, Oracle 19c SELECT From 55de5c5e4fd7234bc3bf96c452dbf8f537d97cec Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:56:06 +0300 Subject: [PATCH 339/402] updated oracle_datafiles_checkpoint_time.sql --- oracle_datafiles_checkpoint_time.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_time.sql b/oracle_datafiles_checkpoint_time.sql index 5e7cbdc..01992d8 100644 --- a/oracle_datafiles_checkpoint_time.sql +++ b/oracle_datafiles_checkpoint_time.sql @@ -15,7 +15,7 @@ -- Oracle Show Checkpoint Dates on DBF data files (relevant for DBA recoveries) -- --- Tested on Oracle 9i, 10g, 11g, Oracle 19c +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT From e6be3cb90cadd33c54b74d745e9885d78615d6ff Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:56:15 +0300 Subject: [PATCH 340/402] updated oracle_datafiles_checkpoint_change.sql --- oracle_datafiles_checkpoint_change.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_change.sql b/oracle_datafiles_checkpoint_change.sql index c097cc6..9ed52ac 100644 --- a/oracle_datafiles_checkpoint_change.sql +++ b/oracle_datafiles_checkpoint_change.sql @@ -15,7 +15,7 @@ -- Oracle Show the Checkpoints on the DBF data files (important for DBA recoveries) -- --- Tested in late 2000s on Oracle 9i, 10g, 11g and in 2024 on Oracle 19c +-- Tested Oracle 9i, 10g, 11g, 19c SELECT checkpoint_change#, From 782ca736bb8a6837231c152f74f7f962a38b459f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:56:23 +0300 Subject: [PATCH 341/402] updated oracle_datafiles_checkpoint_change.sql --- oracle_datafiles_checkpoint_change.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_datafiles_checkpoint_change.sql b/oracle_datafiles_checkpoint_change.sql index 9ed52ac..a6f2efe 100644 --- a/oracle_datafiles_checkpoint_change.sql +++ b/oracle_datafiles_checkpoint_change.sql @@ -15,7 +15,7 @@ -- Oracle Show the Checkpoints on the DBF data files (important for DBA recoveries) -- --- Tested Oracle 9i, 10g, 11g, 19c +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT checkpoint_change#, From 2aca8275be0ac0b1a049a162985b039d74ae89af Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:56:33 +0300 Subject: [PATCH 342/402] updated oracle_checkpoints.sql --- oracle_checkpoints.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql index f8fc992..36d3494 100644 --- a/oracle_checkpoints.sql +++ b/oracle_checkpoints.sql @@ -15,7 +15,7 @@ -- Oracle Show Checkpoints on DBF data files (relevant for DBA recoveries) -- --- Tested in late 2000s on Oracle 9i, 10g, 11g and 2024 on Oracle 19c +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT NAME, From 98d6ef516df79ad5b85d5961bcf3c17dc9623f8e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:58:01 +0300 Subject: [PATCH 343/402] updated oracle_datafiles_unrecoverable_change.sql --- oracle_datafiles_unrecoverable_change.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_datafiles_unrecoverable_change.sql b/oracle_datafiles_unrecoverable_change.sql index 8ac159f..9eeef9f 100644 --- a/oracle_datafiles_unrecoverable_change.sql +++ b/oracle_datafiles_unrecoverable_change.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle +-- +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT unrecoverable_change#, From 067963c976d8af361c2ebd302e8b89ce8429da76 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 05:59:41 +0300 Subject: [PATCH 344/402] updated oracle_show_dba_recyclebin.sql --- oracle_show_dba_recyclebin.sql | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/oracle_show_dba_recyclebin.sql b/oracle_show_dba_recyclebin.sql index b80371a..fca465d 100644 --- a/oracle_show_dba_recyclebin.sql +++ b/oracle_show_dba_recyclebin.sql @@ -14,20 +14,19 @@ -- -- Oracle - Show All Users Recyclebins via DBA Recyclebin +-- +-- Tested on Oracle 19c SELECT - --owner, - --object_name, - username, + owner, + object_name, original_name, type, - drop_time, - is_parent, - recyclebin_name + droptime, + space FROM dba_recyclebin ORDER BY - --owner, - username, - drop_time + owner, + droptime DESC; From b4727003b6ff81adb58eea8b32e6fd4d2e8a4916 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:02:20 +0300 Subject: [PATCH 345/402] updated oracle_table_space.sql --- oracle_table_space.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 6981394..5c6d02d 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -40,5 +40,5 @@ WHERE AND owner <> 'SYS' ORDER BY - free_space_mb DESC, - total_mb DESC; + free_space_gb DESC, + total_gb DESC; From 5ed9f50c6d6864eb3c25d96b278faf811ab2b900 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:02:28 +0300 Subject: [PATCH 346/402] updated oracle_table_space.sql --- oracle_table_space.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 5c6d02d..6e317d8 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -14,6 +14,8 @@ -- -- Oracle - Show Tables' Space Used vs Free and Percentage Percentage where they are at lease 20% utilized +-- +-- Tested on Oracle 19c SELECT owner, From b69f486b09ce5d0583438c9c63b7db9b49bc522d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:04:37 +0300 Subject: [PATCH 347/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 8b8be15..c5e2669 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -14,6 +14,8 @@ -- -- Oracle - Show Tablespace Size, Space Used vs Free in GB and as a Percentage +-- +-- Tested on Oracle 19c SELECT df.tablespace_name "Tablespace", @@ -36,5 +38,5 @@ GROUP BY df.tablespace_name, df.bytes ORDER BY - "Free %" -ASC; + "Free Space %" +DESC; From e1ed3a7cad5f90faee1ba66ea158b01b918e886a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:05:08 +0300 Subject: [PATCH 348/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index dae2ecf..ae0e19f 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -14,6 +14,8 @@ -- -- Oracle - Show Tablespace Size, Space Used GB and Percentage Used +-- +-- Tested on Oracle 19c SELECT tablespace_name "Tablespace", @@ -25,5 +27,5 @@ SELECT FROM dba_tablespace_usage_metrics ORDER BY - "Used %" + "Used Space %" DESC; From 4365f32b9cfc3c742dcba54d3e8eff0b8392555f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:06:28 +0300 Subject: [PATCH 349/402] updated oracle_user_sid_serial_status.sql --- oracle_user_sid_serial_status.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_user_sid_serial_status.sql b/oracle_user_sid_serial_status.sql index 7f7c375..7f309e5 100644 --- a/oracle_user_sid_serial_status.sql +++ b/oracle_user_sid_serial_status.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle last tested in late 2000s on Oracle 9i - 11 +-- Oracle - Show User Sessions Status +-- +-- Tested on Oracle 9i, 10g, 11g, 19c SELECT username, From d6ad6dd1c33a25cf11f161750ee4eb2ddd47f50f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:06:48 +0300 Subject: [PATCH 350/402] renamed oracle_user_sid_serial_status.sql to oracle_user_sessions.sql --- oracle_user_sid_serial_status.sql => oracle_user_sessions.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename oracle_user_sid_serial_status.sql => oracle_user_sessions.sql (100%) diff --git a/oracle_user_sid_serial_status.sql b/oracle_user_sessions.sql similarity index 100% rename from oracle_user_sid_serial_status.sql rename to oracle_user_sessions.sql From c4bf56dc8dce0ad58c3aeb2f511b4ac9d1637f5e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:18:20 +0300 Subject: [PATCH 351/402] added oracle_recent_queries.sql --- oracle_recent_queries.sql | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 oracle_recent_queries.sql diff --git a/oracle_recent_queries.sql b/oracle_recent_queries.sql new file mode 100644 index 0000000..f00f9c1 --- /dev/null +++ b/oracle_recent_queries.sql @@ -0,0 +1,27 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-12 06:17:50 +0300 (Sat, 12 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show Recent Queries +-- +-- Testd on Oracle 19c + +SELECT + sql_text, + executions +FROM + v$sql +ORDER BY + last_active_time +DESC; From fa10258f3c7b951d6145856329e171eda6ea444e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:22:05 +0300 Subject: [PATCH 352/402] updated oracle_recent_queries.sql --- oracle_recent_queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_recent_queries.sql b/oracle_recent_queries.sql index f00f9c1..2331d3e 100644 --- a/oracle_recent_queries.sql +++ b/oracle_recent_queries.sql @@ -15,7 +15,7 @@ -- Oracle - Show Recent Queries -- --- Testd on Oracle 19c +-- Tested on Oracle 19c SELECT sql_text, From d04d5cdfcc3f2549cc83117ce1e918f04768746f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:29:13 +0300 Subject: [PATCH 353/402] updated .mdl.rb --- .mdl.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.mdl.rb b/.mdl.rb index e69de29..da67a74 100644 --- a/.mdl.rb +++ b/.mdl.rb @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +# vim:ts=4:sts=4:sw=4:et:filetype=ruby +# +# Author: Hari Sekhon +# Date: 2024-08-22 01:58:12 +0200 (Thu, 22 Aug 2024) +# +# https///github.com/HariSekhon/SQL-scripts +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +all +#exclude_rule 'MD001' +#exclude_rule 'MD003' +#exclude_rule 'MD005' +exclude_rule 'MD007' # leave 2 space indentation for lists, 3 space is ugly af +#exclude_rule 'MD012' +exclude_rule 'MD013' # long lines cannot be split if they are URLs +#exclude_rule 'MD022' +#exclude_rule 'MD025' +exclude_rule 'MD026' # Trailing punctuation in header - sometimes I want to do etc. or ... at the end of a heading +#exclude_rule 'MD031' +#exclude_rule 'MD032' +exclude_rule 'MD033' # inline HTML is important for formatting +exclude_rule 'MD036' # emphasis used instead of header for footer Ported from lines +#exclude_rule 'MD039' +#exclude_rule 'MD056' From d2d3df449f02b3c7535dff31dfb07bc853781d28 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:29:14 +0300 Subject: [PATCH 354/402] updated .mdlrc --- .mdlrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.mdlrc b/.mdlrc index e69de29..27e5b68 100644 --- a/.mdlrc +++ b/.mdlrc @@ -0,0 +1,5 @@ +mdlrc_dir = File.expand_path('..', __FILE__) + +style_file = File.join(mdlrc_dir, '.mdl.rb') + +style style_file From b40da75fb6445860b9e34cc434fc379c6b7496b8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:29:36 +0300 Subject: [PATCH 355/402] updated README.md --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea948e8..a062fa9 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,24 @@ Cloud & Big Data Contractor, United Kingdom - [analytics/](https://github.com/HariSekhon/SQL-scripts/tree/master/analytics)`bigquery_*.sql` - ecommerce queries and [BigQuery ML](https://cloud.google.com/bigquery-ml/docs/bigqueryml-intro) machine learning classification logistic regression models and purchasing predictions - for more [BigQuery](https://cloud.google.com/bigquery) examples, see [Data Engineering demos](https://github.com/GoogleCloudPlatform/training-data-analyst/tree/master/courses/data-engineering/demos) +### Database Knowledge Base + +See the pages for: + +- [SQL](https://github.com/HariSekhon/Knowledge-Base/blob/main/sql.md) +- [SQL Databases](https://github.com/HariSekhon/Knowledge-Base/blob/main/databases.md) +- [MySQL](https://github.com/HariSekhon/Knowledge-Base/blob/main/mysql.md) +- [PostgreSQL](https://github.com/HariSekhon/Knowledge-Base/blob/main/postgres.md) +- [Oracle](https://github.com/HariSekhon/Knowledge-Base/blob/main/oracle.md) + +in the [HariSekhon/Knowledge-Base](https://github.com/HariSekhon/Knowledge-Base) repo: + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Knowledge-Base&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Knowledge-Base) + ### DevOps SQL tooling +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=DevOps-Bash-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/DevOps-Bash-tools) + You can quickly test the PostgreSQL / MySQL scripts using `postgres.sh` / `mysqld.sh` / `mariadb.sh` in the [DevOps Bash tools](https://github.com/HariSekhon/DevOps-Bash-tools) repo, which boots a docker container and drops straight in to a `mysql` / `psql` shell with this directory mounted at `/sql` and used as `$PWD` for fast easy sourcing eg. postgres: @@ -114,9 +130,9 @@ source /sql/mysql_sessions.sql - [hive_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_column_counts.sh) / [impala_tables_column_counts.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_column_counts.sh) - get the column counts for big tables in Hive / Impala - [hive_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_metadata.sh) / [impala_tables_metadata.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_metadata.sh) / [hive_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/hive_tables_locations.sh) / [impala_tables_locations.sh](https://github.com/HariSekhon/DevOps-Bash-tools/blob/master/bigdata/impala_tables_locations.sh) - get Hive / Impala metadata for all or a subset of tables, eg. Location to determine where the external tables data is being stored (HDFS / S3 paths) -## Stargazers over time +## Star History -[![Stargazers over time](https://starchart.cc/HariSekhon/SQL-scripts.svg)](https://starchart.cc/HariSekhon/SQL-scripts) +[![Star History Chart](https://api.star-history.com/svg?repos=HariSekhon/SQL-scripts&type=Date)](https://star-history.com/#HariSekhon/SQL-scripts&Date) [git.io/SQL](https://git.io/SQL) From 9da740f45a950b552a241aa6787f4dd224c4c1cf Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:31:45 +0300 Subject: [PATCH 356/402] updated README.md --- analytics/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analytics/README.md b/analytics/README.md index 9ded54f..163d575 100644 --- a/analytics/README.md +++ b/analytics/README.md @@ -4,6 +4,6 @@ Load public dataset into your BigQuery using this link: -https://console.cloud.google.com/bigquery?p=data-to-insights&d=ecommerce&t=web_analytics&page=table + Then run the analytics SQL examples from here. From 00618b3ea11dba4a07f05319b7906de7ab38ff86 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:34:07 +0300 Subject: [PATCH 357/402] updated README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a062fa9..3e95877 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,9 @@ Cloud & Big Data Contractor, United Kingdom - [PostgreSQL](https://www.postgresql.org/) queries for DBA investigating + performance tuning - [postgres_info.sql](https://github.com/HariSekhon/SQL-scripts/blob/master/postgres_info.sql) - big summary overview, recommend you start here - tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.x +- `oracle_*.sql`: + - [Oracle](https://wwww.oracle.com) queries for DBA investigating + - tested on Oracle 9i, 10g, 11g, 19c ### Analytics From 1334b9064653ffdec1298e62a9dc3ddfc9c42612 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 12 Oct 2024 06:34:57 +0300 Subject: [PATCH 358/402] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e95877..d3656b7 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Cloud & Big Data Contractor, United Kingdom - [postgres_info.sql](https://github.com/HariSekhon/SQL-scripts/blob/master/postgres_info.sql) - big summary overview, recommend you start here - tested on PostgreSQL 8.4, 9.x, 10.x, 11.x, 12.x, 13.x - `oracle_*.sql`: - - [Oracle](https://wwww.oracle.com) queries for DBA investigating + - [Oracle](https://www.oracle.com) queries for DBA investigating - tested on Oracle 9i, 10g, 11g, 19c ### Analytics From 50731667d1e3b5a9a950c7fd55c12fd4936c62f5 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sun, 13 Oct 2024 00:25:01 +0300 Subject: [PATCH 359/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index c5e2669..59dedb5 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -38,5 +38,5 @@ GROUP BY df.tablespace_name, df.bytes ORDER BY - "Free Space %" -DESC; + "Free Space (GB)" DESC, + "Used Space (GB)" DESC; From 767361e59bb2f71a0263c7ceb4532e79f9ea2b4b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sun, 13 Oct 2024 00:28:53 +0300 Subject: [PATCH 360/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index ae0e19f..319c9d1 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -27,5 +27,4 @@ SELECT FROM dba_tablespace_usage_metrics ORDER BY - "Used Space %" -DESC; + "Used Space %" DESC; From e66341590a2a5b80994871fb8b6c09aa6b09d576 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:07:36 +0400 Subject: [PATCH 361/402] updated oracle_table_space.sql --- oracle_table_space.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 6e317d8..28d8963 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -40,7 +40,8 @@ WHERE ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / (blocks * 8 / 1024 / 1024) > 0.2 AND - owner <> 'SYS' + owner NOT IN + ('SYS', 'SYSTEM', 'SYSAUX', 'RDSADMIN') ORDER BY free_space_gb DESC, total_gb DESC; From 59b914192f6ea0eca88dc5f651e2e7dc7dbdd771 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:38:04 +0400 Subject: [PATCH 362/402] updated oracle_table_space.sql --- oracle_table_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 28d8963..a43209c 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -38,7 +38,7 @@ WHERE num_rows > 0 AND ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / - (blocks * 8 / 1024 / 1024) > 0.2 + (blocks * 8 / 1024 / 1024) > 0.2 -- TUNE: currently only showing tables with over 20% free space AND owner NOT IN ('SYS', 'SYSTEM', 'SYSAUX', 'RDSADMIN') From 8e235b7833fe6c74d464f7e608b97579532ce39f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:48:23 +0400 Subject: [PATCH 363/402] added oracle_table_space_for_schema.sql --- oracle_table_space_for_schema.sql | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 oracle_table_space_for_schema.sql diff --git a/oracle_table_space_for_schema.sql b/oracle_table_space_for_schema.sql new file mode 100644 index 0000000..a43209c --- /dev/null +++ b/oracle_table_space_for_schema.sql @@ -0,0 +1,47 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show Tables' Space Used vs Free and Percentage Percentage where they are at lease 20% utilized +-- +-- Tested on Oracle 19c + +SELECT + owner, + table_name, + -- each block is 8KB, multiply it to GB, round to two decimal places + ROUND(blocks * 8 / 1024 / 1024, 2) AS total_gb, + -- estimate data size from rows vs average row size, round to two decimal places + ROUND(num_rows * avg_row_len / 1024 / 1024 / 1024, 2) AS actual_data_gb, + -- estimate free space by subtracting the two above calculations + ROUND((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024), 2) AS free_space_gb, + -- calculate free space percentage from the above three calculations + ROUND( + ( (blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024) ) / + (blocks * 8 / 1024 / 1024) * 100, 2) AS free_space_pct +FROM + dba_tables +WHERE + blocks > 0 + AND + num_rows > 0 + AND + ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / + (blocks * 8 / 1024 / 1024) > 0.2 -- TUNE: currently only showing tables with over 20% free space + AND + owner NOT IN + ('SYS', 'SYSTEM', 'SYSAUX', 'RDSADMIN') +ORDER BY + free_space_gb DESC, + total_gb DESC; From 5d1e2ee925709e177b0b1d86ad89bb019d24d972 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:52:49 +0400 Subject: [PATCH 364/402] updated oracle_table_space_for_schema.sql --- oracle_table_space_for_schema.sql | 38 +++++++++++++++++++------------ 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/oracle_table_space_for_schema.sql b/oracle_table_space_for_schema.sql index a43209c..dbc34f3 100644 --- a/oracle_table_space_for_schema.sql +++ b/oracle_table_space_for_schema.sql @@ -18,30 +18,38 @@ -- Tested on Oracle 19c SELECT - owner, - table_name, + t.owner, + t.table_name, -- each block is 8KB, multiply it to GB, round to two decimal places - ROUND(blocks * 8 / 1024 / 1024, 2) AS total_gb, + ROUND(t.blocks * 8 / 1024 / 1024, 2) AS total_gb_from_tables, + -- estimate from segments + ROUND(s.bytes / 1024 / 1024 / 1024, 2) AS total_gb_from_segments, -- estimate data size from rows vs average row size, round to two decimal places - ROUND(num_rows * avg_row_len / 1024 / 1024 / 1024, 2) AS actual_data_gb, + ROUND(t.num_rows * t.avg_row_len / 1024 / 1024 / 1024, 2) AS actual_data_gb, -- estimate free space by subtracting the two above calculations - ROUND((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024), 2) AS free_space_gb, + ROUND(((t.blocks * 8 / 1024) - (t.num_rows * t.avg_row_len / 1024 / 1024)) / 1024, 2) AS free_space_gb, -- calculate free space percentage from the above three calculations ROUND( - ( (blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024) ) / - (blocks * 8 / 1024 / 1024) * 100, 2) AS free_space_pct + ( (t.blocks * 8) - (t.num_rows * t.avg_row_len / 1024) ) / + (t.blocks * 8) * 100, 2) AS free_space_pct, + t.last_analyzed FROM - dba_tables + dba_tables t +JOIN + dba_segments s +ON + t.owner = s.owner + AND + t.table_name = s.segment_name WHERE - blocks > 0 + t.blocks > 0 AND - num_rows > 0 + t.num_rows > 0 AND - ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / - (blocks * 8 / 1024 / 1024) > 0.2 -- TUNE: currently only showing tables with over 20% free space + -- TUNE: currently only showing tables with over 20% free space + ((t.blocks * 8 / 1024) - (t.num_rows * t.avg_row_len / 1024 / 1024)) / (t.blocks * 8 / 1024) > 0.2 AND - owner NOT IN - ('SYS', 'SYSTEM', 'SYSAUX', 'RDSADMIN') + t.owner = 'USERS' -- XXX: Change this to your owner schema ORDER BY free_space_gb DESC, - total_gb DESC; + total_gb_from_segments DESC; From 9200c04cbd9f2b101a24003f8101c96f2c4f35e0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:57:43 +0400 Subject: [PATCH 365/402] updated oracle_table_space.sql --- oracle_table_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index a43209c..2388a96 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -38,7 +38,7 @@ WHERE num_rows > 0 AND ((blocks * 8 / 1024 / 1024) - (num_rows * avg_row_len / 1024 / 1024 / 1024)) / - (blocks * 8 / 1024 / 1024) > 0.2 -- TUNE: currently only showing tables with over 20% free space + (blocks * 8 / 1024 / 1024) > 0.2 -- TUNE: currently only showing tables over 20% utilized AND owner NOT IN ('SYS', 'SYSTEM', 'SYSAUX', 'RDSADMIN') From 18da5195d276c3b09ded6c354963a203ef873dd7 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:58:33 +0400 Subject: [PATCH 366/402] updated oracle_table_space.sql --- oracle_table_space.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index 2388a96..a415d2e 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tables' Space Used vs Free and Percentage Percentage where they are at lease 20% utilized +-- Oracle - Show Tables' Space Used vs Free and Percentage Percentage +-- +-- where the table are over 20% utilized -- -- Tested on Oracle 19c From 2ba676148beb0b6d60ea169b0db45d495d5fc8ec Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:58:42 +0400 Subject: [PATCH 367/402] updated oracle_table_space.sql --- oracle_table_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index a415d2e..c489cd9 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -15,7 +15,7 @@ -- Oracle - Show Tables' Space Used vs Free and Percentage Percentage -- --- where the table are over 20% utilized +-- where the tables are over 20% utilized -- -- Tested on Oracle 19c From 3978d953775a34d718ee627dd26754d4a35efac6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 05:59:11 +0400 Subject: [PATCH 368/402] updated oracle_table_space_for_schema.sql --- oracle_table_space_for_schema.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oracle_table_space_for_schema.sql b/oracle_table_space_for_schema.sql index dbc34f3..2944a53 100644 --- a/oracle_table_space_for_schema.sql +++ b/oracle_table_space_for_schema.sql @@ -13,7 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tables' Space Used vs Free and Percentage Percentage where they are at lease 20% utilized +-- Oracle - Show Tables' Space Used vs Free and Percentage Percentage +-- +-- for tables over 20% utilized in a given tablespace -- -- Tested on Oracle 19c @@ -46,7 +48,7 @@ WHERE AND t.num_rows > 0 AND - -- TUNE: currently only showing tables with over 20% free space + -- TUNE: currently only showing tables over 20% utilized ((t.blocks * 8 / 1024) - (t.num_rows * t.avg_row_len / 1024 / 1024)) / (t.blocks * 8 / 1024) > 0.2 AND t.owner = 'USERS' -- XXX: Change this to your owner schema From 6ce19ef98b4aa4a8b6b06ea8a961b6c5260be330 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 06:08:52 +0400 Subject: [PATCH 369/402] updated oracle_table_space_for_schema.sql --- oracle_table_space_for_schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oracle_table_space_for_schema.sql b/oracle_table_space_for_schema.sql index 2944a53..1a3fe0a 100644 --- a/oracle_table_space_for_schema.sql +++ b/oracle_table_space_for_schema.sql @@ -13,9 +13,9 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tables' Space Used vs Free and Percentage Percentage +-- Oracle - Show Tables' Space Used vs Free and Free Percentage in a given Tablespace -- --- for tables over 20% utilized in a given tablespace +-- for tables over 20% utilized -- -- Tested on Oracle 19c From e1ad429eff47f28770969ec979527c6ecef19bb2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 06:09:43 +0400 Subject: [PATCH 370/402] added oracle_table_segments_for_schema.sql --- oracle_table_segments_for_schema.sql | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 oracle_table_segments_for_schema.sql diff --git a/oracle_table_segments_for_schema.sql b/oracle_table_segments_for_schema.sql new file mode 100644 index 0000000..e52aecf --- /dev/null +++ b/oracle_table_segments_for_schema.sql @@ -0,0 +1,42 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show Tables' Segments Size in a given Tablespace +-- +-- Tested on Oracle 19c + +SELECT + segment_name, + segment_type, + tablespace_name, + bytes/1024/1024/1024 AS size_gb, + blocks +FROM + dba_segments +WHERE + owner = 'USERS' -- XXX: Edit this + AND + segment_type = 'TABLE' + AND + blocks > 8 + -- to look at only specific tables + -- AND + --segment_name IN + --('MY_TABLE_1', + -- 'MY_TABLE_2', + -- 'MY_TABLE_3', + -- 'MY_TABLE_4') +ORDER BY + size_gb DESC; From fbac2549d0ceba4a26cf4729296c0cc749482af1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 06:12:32 +0400 Subject: [PATCH 371/402] updated oracle_table_space.sql --- oracle_table_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index c489cd9..e9986b0 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Tables' Space Used vs Free and Percentage Percentage +-- Oracle - Show Tables' Space Used vs Free and Free Percentage -- -- where the tables are over 20% utilized -- From 5cb9209898f3033c5f80ee3f0ae124f1b70962e8 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 06:15:54 +0400 Subject: [PATCH 372/402] added oracle_table_shrink_candidates.sql --- oracle_table_shrink_candidates.sql | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 oracle_table_shrink_candidates.sql diff --git a/oracle_table_shrink_candidates.sql b/oracle_table_shrink_candidates.sql new file mode 100644 index 0000000..3bf79ab --- /dev/null +++ b/oracle_table_shrink_candidates.sql @@ -0,0 +1,36 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show Table Candidates to Move / Shrink in a given Tablespace +-- +-- where the tables are over 20% utilized +-- +-- Tested on Oracle 19c + +SELECT + segment_name, + segment_type, + ROUND(SUM(bytes)/1024/1024/1024, 2) AS size_gb +FROM + dba_segments +WHERE + tablespace_name = 'USERS' -- XXX: Edit +GROUP BY + segment_name, + segment_type +HAVING + SUM(bytes)/1024/1024/1024 > 1 +ORDER BY + size_gb DESC; From 6a24322088d82275a39b3083584e0308ba811455 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 22:48:45 +0400 Subject: [PATCH 373/402] updated oracle_table_space.sql --- oracle_table_space.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oracle_table_space.sql b/oracle_table_space.sql index e9986b0..ad4cc53 100644 --- a/oracle_table_space.sql +++ b/oracle_table_space.sql @@ -17,6 +17,10 @@ -- -- where the tables are over 20% utilized -- +-- Calculations assume an 8KB block size, which you should verify like this: +-- +-- SELECT value FROM v$parameter WHERE name = 'db_block_size'; +-- -- Tested on Oracle 19c SELECT From c2675bc231dcaa08fd8d4c6a2aba3e4ee1bdec1b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 22:48:57 +0400 Subject: [PATCH 374/402] updated oracle_table_space_for_schema.sql --- oracle_table_space_for_schema.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oracle_table_space_for_schema.sql b/oracle_table_space_for_schema.sql index 1a3fe0a..4456738 100644 --- a/oracle_table_space_for_schema.sql +++ b/oracle_table_space_for_schema.sql @@ -17,6 +17,10 @@ -- -- for tables over 20% utilized -- +-- Calculations assume an 8KB block size, which you should verify like this: +-- +-- SELECT value FROM v$parameter WHERE name = 'db_block_size'; +-- -- Tested on Oracle 19c SELECT From d32cf4192b20e757649c33d9709c0a4a1d97f2f2 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 22:49:24 +0400 Subject: [PATCH 375/402] updated oracle_tablespace_space2.sql --- oracle_tablespace_space2.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oracle_tablespace_space2.sql b/oracle_tablespace_space2.sql index 319c9d1..7354551 100644 --- a/oracle_tablespace_space2.sql +++ b/oracle_tablespace_space2.sql @@ -15,6 +15,10 @@ -- Oracle - Show Tablespace Size, Space Used GB and Percentage Used -- +-- Calculations assume an 8KB block size, which you should verify like this: +-- +-- SELECT value FROM v$parameter WHERE name = 'db_block_size'; +-- -- Tested on Oracle 19c SELECT From c322b0e5f307fa5f0c02871c1d0fe3ce7dada84c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 23:07:01 +0400 Subject: [PATCH 376/402] added oracle_show_sessions_using_temp_tablespace.sql --- ...le_show_sessions_using_temp_tablespace.sql | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 oracle_show_sessions_using_temp_tablespace.sql diff --git a/oracle_show_sessions_using_temp_tablespace.sql b/oracle_show_sessions_using_temp_tablespace.sql new file mode 100644 index 0000000..b0908ea --- /dev/null +++ b/oracle_show_sessions_using_temp_tablespace.sql @@ -0,0 +1,35 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-17 23:06:57 +0400 (Thu, 17 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https://github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show User Sessions Using Temporary Tablespace +-- +-- Check there are none before dropping an old temp tablespace file to avoid disruptions +-- +-- Tested on Oracle 19c + +SELECT + s.sid, + s.username, + t.tablespace, + t.blocks, + t.segfile#, + t.segblk#, + t.contents, + t.sql_id +FROM + v$sort_usage t, + v$session s +WHERE + t.session_addr = s.saddr; From b65b0af3c1d9a86f393c4ea7bb9751f02da82e29 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 17 Oct 2024 23:18:32 +0400 Subject: [PATCH 377/402] updated oracle_tablespace_space.sql --- oracle_tablespace_space.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_tablespace_space.sql b/oracle_tablespace_space.sql index 59dedb5..c9ddd35 100644 --- a/oracle_tablespace_space.sql +++ b/oracle_tablespace_space.sql @@ -21,7 +21,7 @@ SELECT df.tablespace_name "Tablespace", df.bytes / (1024 * 1024 * 1024) "Size (GB)", (df.bytes - SUM(fs.bytes)) / (1024 * 1024 * 1024) "Used Space (GB)", - SUM(fs.bytes) / (1024 * 1024 * 1024) "Free Space (GB)", + ROUND(SUM(fs.bytes) / (1024 * 1024 * 1024), 2) "Free Space (GB)", ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free Space %" FROM dba_free_space fs, From ac9afa8de5a26349c8b2027afcf0ebb1a4d980d0 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 01:21:04 +0400 Subject: [PATCH 378/402] added oracle_tablespace_datafiles_sum_vs_max_autoextend.sql --- ...espace_datafiles_sum_vs_max_autoextend.sql | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 oracle_tablespace_datafiles_sum_vs_max_autoextend.sql diff --git a/oracle_tablespace_datafiles_sum_vs_max_autoextend.sql b/oracle_tablespace_datafiles_sum_vs_max_autoextend.sql new file mode 100644 index 0000000..cde37c7 --- /dev/null +++ b/oracle_tablespace_datafiles_sum_vs_max_autoextend.sql @@ -0,0 +1,29 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-18 01:18:50 +0400 (Fri, 18 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Tablespace Datafiles Sum vs Max and AutoExtend + + +SELECT + tablespace_name, + ROUND(SUM(BYTES)/(1024*1024*1024),2) Total_GB, + ROUND(MAXBYTES/(1024*1024*1024),2) Max_GB, + autoextensible +FROM + dba_data_files +GROUP BY + tablespace_name, + maxbytes, + autoextensible; From ae76d264001b7f80cdc4125c90e2eddfb160246e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 01:22:47 +0400 Subject: [PATCH 379/402] added oracle_tablespace_datafiles_sum_vs_max_autoextend_temp.sql --- ...e_datafiles_sum_vs_max_autoextend_temp.sql | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 oracle_tablespace_datafiles_sum_vs_max_autoextend_temp.sql diff --git a/oracle_tablespace_datafiles_sum_vs_max_autoextend_temp.sql b/oracle_tablespace_datafiles_sum_vs_max_autoextend_temp.sql new file mode 100644 index 0000000..1aad957 --- /dev/null +++ b/oracle_tablespace_datafiles_sum_vs_max_autoextend_temp.sql @@ -0,0 +1,29 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-18 01:18:50 +0400 (Fri, 18 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Temp Tablespace Datafiles Sum vs Max and AutoExtend + + +SELECT + tablespace_name, + ROUND(SUM(BYTES)/(1024*1024*1024),2) Total_GB, + ROUND(MAXBYTES/(1024*1024*1024),2) Max_GB, + autoextensible +FROM + dba_temp_files +GROUP BY + tablespace_name, + maxbytes, + autoextensible; From 872f79ca7a6f10e890c902807eb0dfd44b8036ae Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 01:22:55 +0400 Subject: [PATCH 380/402] updated oracle_checkpoints.sql --- oracle_checkpoints.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_checkpoints.sql b/oracle_checkpoints.sql index 36d3494..19b7f5c 100644 --- a/oracle_checkpoints.sql +++ b/oracle_checkpoints.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle Show Checkpoints on DBF data files (relevant for DBA recoveries) +-- Oracle - Show Checkpoints on DBF data files (relevant for DBA recoveries) -- -- Tested on Oracle 9i, 10g, 11g, 19c From 26429705b7333b3513dd3ce46db26ade6dc1f42c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 01:26:22 +0400 Subject: [PATCH 381/402] added oracle_rds_ddl_tablespace.sql --- oracle_rds_ddl_tablespace.sql | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 oracle_rds_ddl_tablespace.sql diff --git a/oracle_rds_ddl_tablespace.sql b/oracle_rds_ddl_tablespace.sql new file mode 100644 index 0000000..d6f9ffc --- /dev/null +++ b/oracle_rds_ddl_tablespace.sql @@ -0,0 +1,21 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-18 01:25:03 +0400 (Fri, 18 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - get the Tablespace DDL + +SELECT + -- USERS tablespace was case sensitive + dbms_metadata.get_ddl('TABLESPACE','USERS') +FROM dual; From f887525e9b0a247ec49ac7fd6a7251ce954c18ad Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 04:25:11 +0400 Subject: [PATCH 382/402] added oracle_tablespace_undo_space.sql --- oracle_tablespace_undo_space.sql | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 oracle_tablespace_undo_space.sql diff --git a/oracle_tablespace_undo_space.sql b/oracle_tablespace_undo_space.sql new file mode 100644 index 0000000..f172263 --- /dev/null +++ b/oracle_tablespace_undo_space.sql @@ -0,0 +1,44 @@ +-- +-- Author: Hari Sekhon +-- Date: 2024-10-18 04:24:34 +0400 (Fri, 18 Oct 2024) +-- +-- vim:ts=4:sts=4:sw=4:et:filetype=sql +-- +-- https///github.com/HariSekhon/SQL-scripts +-- +-- License: see accompanying Hari Sekhon LICENSE file +-- +-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +-- +-- https://www.linkedin.com/in/HariSekhon +-- + +-- Oracle - Show Tablespace size of the Undo Tablespace +-- +-- Tested on Oracle 19c + +SELECT + df.tablespace_name "Tablespace", + df.bytes / (1024 * 1024 * 1024) "Size (GB)", + (df.bytes - SUM(fs.bytes)) / (1024 * 1024 * 1024) "Used Space (GB)", + ROUND(SUM(fs.bytes) / (1024 * 1024 * 1024), 2) "Free Space (GB)", + ROUND(SUM(fs.bytes) / df.bytes * 100, 2) "Free Space %" +FROM + dba_free_space fs, + (SELECT + tablespace_name, + SUM(bytes) bytes + FROM + dba_data_files + GROUP BY + tablespace_name) df +WHERE + fs.tablespace_name (+) = df.tablespace_name + AND + UPPER(fs.tablespace_name) LIKE '%UNDO%' +GROUP BY + df.tablespace_name, + df.bytes +ORDER BY + "Free Space (GB)" DESC, + "Used Space (GB)" DESC; From de9dd5ed0e8761d1fa373937e1d39e6475a091ce Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 18 Oct 2024 04:28:24 +0400 Subject: [PATCH 383/402] updated oracle_table_shrink_candidates.sql --- oracle_table_shrink_candidates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle_table_shrink_candidates.sql b/oracle_table_shrink_candidates.sql index 3bf79ab..0ac0208 100644 --- a/oracle_table_shrink_candidates.sql +++ b/oracle_table_shrink_candidates.sql @@ -13,7 +13,7 @@ -- https://www.linkedin.com/in/HariSekhon -- --- Oracle - Show Table Candidates to Move / Shrink in a given Tablespace +-- Oracle - Show Table Candidates to Move / Shrink in a given Tablespace 'USERS' -- -- where the tables are over 20% utilized -- From 8ab1204a2618cc471f04c7a2ac39fac29d69fc94 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 22 Nov 2024 17:51:55 +0400 Subject: [PATCH 384/402] updated .pre-commit-config.yaml --- .pre-commit-config.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7467ebe..d947e90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,14 +30,14 @@ repos: hooks: - id: check-yaml # Common errors - - id: end-of-file-fixer + #- id: end-of-file-fixer # ruins .gitignore Icon\r - id: trailing-whitespace args: [--markdown-linebreak-ext=md] # Git style - id: check-added-large-files - id: check-merge-conflict - id: check-vcs-permalinks - - id: forbid-new-submodules + #- id: forbid-new-submodules # Cross platform - id: check-case-conflict - id: mixed-line-ending @@ -46,10 +46,11 @@ repos: - id: detect-aws-credentials args: ['--allow-missing-credentials'] - - repo: https://github.com/psf/black - rev: 24.8.0 - hooks: - - id: black + # rewrites python files with useless changes like changing single quotes to double quotes + #- repo: https://github.com/psf/black + # rev: 24.8.0 + # hooks: + # - id: black # Git secrets Leaks - repo: https://github.com/awslabs/git-secrets.git From 68769b9268559f9dca3e496d495f2f9b9e64e2e9 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sun, 2 Feb 2025 00:20:38 +0700 Subject: [PATCH 385/402] added lint exception for on: truthy --- .github/workflows/checkov.yaml | 2 +- .github/workflows/codeowners.yaml | 2 +- .github/workflows/fork-sync.yaml | 2 +- .github/workflows/fork-update-pr.yaml | 2 +- .github/workflows/grype.yaml | 2 +- .github/workflows/json.yaml | 2 +- .github/workflows/kics.yaml | 2 +- .github/workflows/markdown.yaml | 2 +- .github/workflows/semgrep-cloud.yaml | 2 +- .github/workflows/semgrep.yaml | 2 +- .github/workflows/shellcheck.yaml | 2 +- .github/workflows/sqlfluff.yaml | 2 +- .github/workflows/trivy.yaml | 2 +- .github/workflows/validate.yaml | 2 +- .github/workflows/xml.yaml | 2 +- .github/workflows/yaml.yaml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/checkov.yaml b/.github/workflows/checkov.yaml index 5850725..0654613 100644 --- a/.github/workflows/checkov.yaml +++ b/.github/workflows/checkov.yaml @@ -22,7 +22,7 @@ --- name: Checkov -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/codeowners.yaml b/.github/workflows/codeowners.yaml index 261c302..e4b6f60 100644 --- a/.github/workflows/codeowners.yaml +++ b/.github/workflows/codeowners.yaml @@ -18,7 +18,7 @@ --- name: CodeOwners -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/fork-sync.yaml b/.github/workflows/fork-sync.yaml index a9a299d..bc0f6d9 100644 --- a/.github/workflows/fork-sync.yaml +++ b/.github/workflows/fork-sync.yaml @@ -20,7 +20,7 @@ --- name: Fork Sync -on: +on: # yamllint disable-line rule:truthy workflow_dispatch: inputs: debug: diff --git a/.github/workflows/fork-update-pr.yaml b/.github/workflows/fork-update-pr.yaml index f65009d..1f25904 100644 --- a/.github/workflows/fork-update-pr.yaml +++ b/.github/workflows/fork-update-pr.yaml @@ -22,7 +22,7 @@ --- name: Fork Update PR -on: +on: # yamllint disable-line rule:truthy workflow_dispatch: inputs: debug: diff --git a/.github/workflows/grype.yaml b/.github/workflows/grype.yaml index 6c8f15d..928e5c6 100644 --- a/.github/workflows/grype.yaml +++ b/.github/workflows/grype.yaml @@ -18,7 +18,7 @@ --- name: Grype -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/json.yaml b/.github/workflows/json.yaml index d009e59..cdb554f 100644 --- a/.github/workflows/json.yaml +++ b/.github/workflows/json.yaml @@ -20,7 +20,7 @@ --- name: JSON -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/kics.yaml b/.github/workflows/kics.yaml index 0a61703..8e8adab 100644 --- a/.github/workflows/kics.yaml +++ b/.github/workflows/kics.yaml @@ -18,7 +18,7 @@ --- name: Kics -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml index a15b157..7717f8b 100644 --- a/.github/workflows/markdown.yaml +++ b/.github/workflows/markdown.yaml @@ -18,7 +18,7 @@ --- name: Markdown -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/semgrep-cloud.yaml b/.github/workflows/semgrep-cloud.yaml index 22d0b73..1aeaee0 100644 --- a/.github/workflows/semgrep-cloud.yaml +++ b/.github/workflows/semgrep-cloud.yaml @@ -20,7 +20,7 @@ --- name: Semgrep Cloud -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 6c7ebff..1d4c5b8 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -22,7 +22,7 @@ --- name: Semgrep -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml index bce7014..ded227e 100644 --- a/.github/workflows/shellcheck.yaml +++ b/.github/workflows/shellcheck.yaml @@ -20,7 +20,7 @@ --- name: ShellCheck -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/sqlfluff.yaml b/.github/workflows/sqlfluff.yaml index f8cf567..75dde06 100644 --- a/.github/workflows/sqlfluff.yaml +++ b/.github/workflows/sqlfluff.yaml @@ -18,7 +18,7 @@ --- name: SQLFluff -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index b6e12e6..cc039d7 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -20,7 +20,7 @@ --- name: Trivy -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 49126ff..bec0a3c 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -20,7 +20,7 @@ --- name: Validation -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/xml.yaml b/.github/workflows/xml.yaml index 58c9ba9..1440b99 100644 --- a/.github/workflows/xml.yaml +++ b/.github/workflows/xml.yaml @@ -20,7 +20,7 @@ --- name: XML -on: +on: # yamllint disable-line rule:truthy push: branches: - master diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml index 2f77e9f..8d990a7 100644 --- a/.github/workflows/yaml.yaml +++ b/.github/workflows/yaml.yaml @@ -20,7 +20,7 @@ --- name: YAML -on: +on: # yamllint disable-line rule:truthy push: branches: - master From c331a88eb3c775590e75e7326f948bcabace3182 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 6 Feb 2025 20:30:36 +0700 Subject: [PATCH 386/402] updated README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3656b7..bf3f241 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![GitHub stars](https://img.shields.io/github/stars/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/stargazers) [![GitHub forks](https://img.shields.io/github/forks/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/network) -[![Lines of Code](https://img.shields.io/badge/lines%20of%20code-5k-lightgrey?logo=codecademy)](https://github.com/HariSekhon/SQL-scripts#SQL-Scripts) +[![LineCount](https://sloc.xyz/github/HariSekhon/SQL-scripts/?badge-bg-color=2081C2)](https://github.com/boyter/scc/) +[![Cocomo](https://sloc.xyz/github/HariSekhon/SQL-scripts/?badge-bg-color=2081C2&category=cocomo)](https://github.com/boyter/scc/) [![License](https://img.shields.io/github/license/HariSekhon/SQL-scripts)](https://github.com/HariSekhon/SQL-scripts/blob/master/LICENSE) [![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/) [![GitHub Last Commit](https://img.shields.io/github/last-commit/HariSekhon/SQL-scripts?logo=github)](https://github.com/HariSekhon/SQL-scripts/commits/master) From b9f5c62f44322a680e1a5f4bc5016b7a1a3e2a70 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 25 Feb 2025 21:29:21 +0700 Subject: [PATCH 387/402] added sonar-project.properties --- sonar-project.properties | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..32a5bb0 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,42 @@ +# vim:ts=4:sts=4:sw=4:et +# +# Author: Hari Sekhon +# Date: 2016-07-19 18:31:17 +0100 (Tue, 19 Jul 2016) +# +# https://github.com/HariSekhon/SQL-scripts +# +# License: see accompanying Hari Sekhon LICENSE file +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# S o n a r Q u b e +# ============================================================================ # + +sonar.host.url=https://sonarcloud.io + +# Required metadata +sonar.organization=harisekhon +sonar.projectName=SQL-scripts +sonar.projectKey=HariSekhon_SQL-scripts +sonar.projectVersion=1.0 + +sonar.projectDescription=SQL-scripts + +sonar.links.homepage=https://github.com/HariSekhon/SQL-scripts +sonar.links.scm=https://github.com/HariSekhon/SQL-scripts +sonar.links.issue=https://github.com/HariSekhon/SQL-scripts/issues +sonar.links.ci=https://github.com/HariSekhon/SQL-scripts/actions + +# directories to scan (defaults to sonar-project.properties dir otherwise) +sonar.sources=. + +#sonar.language=py + +sonar.sourceEncoding=UTF-8 + +#sonar.exclusions=**/tests/** +#sonar.exclusions=**/zookeeper-*/**/* From a86f2b7a26ea0e4d74c0d43c6bee66490c9b7fb1 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:25:55 +0700 Subject: [PATCH 388/402] added sonarcloud.yaml --- .github/workflows/sonarcloud.yaml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/sonarcloud.yaml diff --git a/.github/workflows/sonarcloud.yaml b/.github/workflows/sonarcloud.yaml new file mode 100644 index 0000000..15cc547 --- /dev/null +++ b/.github/workflows/sonarcloud.yaml @@ -0,0 +1,48 @@ +# +# Author: Hari Sekhon +# Date: 2023-04-14 23:53:43 +0100 (Fri, 14 Apr 2023) +# +# vim:ts=2:sts=2:sw=2:et +# +# https://github.com/HariSekhon/SQL-scripts +# +# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback +# +# https://www.linkedin.com/in/HariSekhon +# + +# ============================================================================ # +# S o n a r C l o u d +# ============================================================================ # + +--- +name: SonarCloud + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + - main + paths-ignore: + - '**/*.md' + pull_request: + branches: + - master + - main + paths-ignore: + - '**/*.md' + workflow_dispatch: + +permissions: + contents: read + pull-requests: read + +jobs: + SonarCloud: + # github.event.repository context not available in scheduled workflows + #if: github.event.repository.fork == false + if: github.repository_owner == 'HariSekhon' + name: SonarCloud + uses: HariSekhon/GitHub-Actions/.github/workflows/sonarcloud.yaml@master + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 4cc55462add7db10c7dfaf471b0be0566dedde5a Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:06 +0700 Subject: [PATCH 389/402] updated codeowners.yaml --- .github/workflows/codeowners.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeowners.yaml b/.github/workflows/codeowners.yaml index e4b6f60..071710d 100644 --- a/.github/workflows/codeowners.yaml +++ b/.github/workflows/codeowners.yaml @@ -46,7 +46,7 @@ permissions: contents: read concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 1328b9227f59dcf85b7a6efd757245ecb91cf53e Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:07 +0700 Subject: [PATCH 390/402] updated fork-sync.yaml --- .github/workflows/fork-sync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fork-sync.yaml b/.github/workflows/fork-sync.yaml index bc0f6d9..572275c 100644 --- a/.github/workflows/fork-sync.yaml +++ b/.github/workflows/fork-sync.yaml @@ -34,7 +34,7 @@ permissions: contents: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false jobs: From f38a1b687c4e592cf61de9aff047e89bc1caf543 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:08 +0700 Subject: [PATCH 391/402] updated fork-update-pr.yaml --- .github/workflows/fork-update-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fork-update-pr.yaml b/.github/workflows/fork-update-pr.yaml index 1f25904..ca2c7e6 100644 --- a/.github/workflows/fork-update-pr.yaml +++ b/.github/workflows/fork-update-pr.yaml @@ -37,7 +37,7 @@ permissions: pull-requests: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false jobs: From d6a9e1d0a3dba38a9fc32324455773a1bc7bea66 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:08 +0700 Subject: [PATCH 392/402] updated grype.yaml --- .github/workflows/grype.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/grype.yaml b/.github/workflows/grype.yaml index 928e5c6..1447493 100644 --- a/.github/workflows/grype.yaml +++ b/.github/workflows/grype.yaml @@ -46,7 +46,7 @@ permissions: security-events: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 4225ceaa42cbbb0064076f9a2bce034ca9c4a3b6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:08 +0700 Subject: [PATCH 393/402] updated kics.yaml --- .github/workflows/kics.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kics.yaml b/.github/workflows/kics.yaml index 8e8adab..c3d629c 100644 --- a/.github/workflows/kics.yaml +++ b/.github/workflows/kics.yaml @@ -46,7 +46,7 @@ permissions: security-events: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From f412635311fc0b1929aaceeb8028d89b62506140 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:09 +0700 Subject: [PATCH 394/402] updated semgrep-cloud.yaml --- .github/workflows/semgrep-cloud.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/semgrep-cloud.yaml b/.github/workflows/semgrep-cloud.yaml index 1aeaee0..d3508c9 100644 --- a/.github/workflows/semgrep-cloud.yaml +++ b/.github/workflows/semgrep-cloud.yaml @@ -46,7 +46,7 @@ permissions: contents: read concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 825e93fa8929cb4230b661b428651a8b465d92d6 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:09 +0700 Subject: [PATCH 395/402] updated semgrep.yaml --- .github/workflows/semgrep.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 1d4c5b8..3005ed1 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -50,7 +50,7 @@ permissions: security-events: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From b1d193c958d2ee94d39eaf423a436e2ea953e69f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:09 +0700 Subject: [PATCH 396/402] updated shellcheck.yaml --- .github/workflows/shellcheck.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml index ded227e..642f533 100644 --- a/.github/workflows/shellcheck.yaml +++ b/.github/workflows/shellcheck.yaml @@ -46,7 +46,7 @@ permissions: contents: read concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 3a07ca9312f289ad5f3c7c61103a628c884235a3 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:10 +0700 Subject: [PATCH 397/402] updated trivy.yaml --- .github/workflows/trivy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index cc039d7..74a08f6 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -48,7 +48,7 @@ permissions: security-events: write concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 1642c30becf5fd350de48a22da8ceeca9176c33f Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:10 +0700 Subject: [PATCH 398/402] updated validate.yaml --- .github/workflows/validate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index bec0a3c..2122c48 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -46,7 +46,7 @@ permissions: contents: read concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From 024a2886efc9b6a9671b4b8dd58a3621508877be Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 00:26:10 +0700 Subject: [PATCH 399/402] updated yaml.yaml --- .github/workflows/yaml.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yaml.yaml b/.github/workflows/yaml.yaml index 8d990a7..4a1b8f8 100644 --- a/.github/workflows/yaml.yaml +++ b/.github/workflows/yaml.yaml @@ -50,7 +50,7 @@ permissions: contents: read concurrency: - group: ${{ github.ref }}-${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: From ee8ff3f301d6250b1b6fe3a93807d63d329f41bd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 26 Feb 2025 19:11:22 +0700 Subject: [PATCH 400/402] added connectedMode.json --- .sonarlint/connectedMode.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .sonarlint/connectedMode.json diff --git a/.sonarlint/connectedMode.json b/.sonarlint/connectedMode.json new file mode 100644 index 0000000..47f535c --- /dev/null +++ b/.sonarlint/connectedMode.json @@ -0,0 +1,4 @@ +{ + "sonarCloudOrganization": "harisekhon", + "projectKey": "HariSekhon_SQL-scripts" +} From 08310861449a9fea7d04b00cee84b1f5718c3122 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Sat, 1 Mar 2025 00:06:06 +0700 Subject: [PATCH 401/402] updated README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index bf3f241..955f313 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,14 @@ [![AWS Aurora](https://img.shields.io/badge/SQL-AWS%20Aurora-232F3E?logo=amazonwebservices)](https://aws.amazon.com/aurora/) [![Google BigQuery](https://img.shields.io/badge/SQL-Google%20BigQuery-4285F4?logo=google%20cloud&logoColor=white)](https://cloud.google.com/bigquery) +[![Codacy](https://app.codacy.com/project/badge/Grade/c7ac78789d854b12aa3d23f36953f7e7)](https://www.codacy.com/gh/HariSekhon/SQL-scripts/dashboard) +[![CodeFactor](https://www.codefactor.io/repository/github/harisekhon/SQL-scripts/badge)](https://www.codefactor.io/repository/github/harisekhon/SQL-scripts) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=HariSekhon_SQL-scripts&metric=alert_status)](https://sonarcloud.io/dashboard?id=HariSekhon_SQL-scripts) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=HariSekhon_SQL-scripts&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=HariSekhon_SQL-scripts) +[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=HariSekhon_SQL-scripts&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=HariSekhon_SQL-scripts) +[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=HariSekhon_SQL-scripts&metric=security_rating)](https://sonarcloud.io/dashboard?id=HariSekhon_SQL-scripts) +[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=HariSekhon_SQL-scripts&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=HariSekhon_SQL-scripts) + [![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://bitbucket.org/HariSekhon/devops-bash-tools/src/master/STATUS.md) [![ShellCheck](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/shellcheck.yaml) [![YAML](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/SQL-scripts/actions/workflows/yaml.yaml) From d91e9dac89d562db337caab195b514882e3253fa Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 6 Nov 2025 23:18:20 +0200 Subject: [PATCH 402/402] updated README.md --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 955f313..c5660d4 100644 --- a/README.md +++ b/README.md @@ -190,24 +190,35 @@ Does nothing: [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=GitHub-Actions&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/GitHub-Actions) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Jenkins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Jenkins) -### DBA - SQL +### Databases - DBA - SQL [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=SQL-scripts&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/SQL-scripts) ### DevOps Reloaded -[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugins) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=HAProxy-configs&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/HAProxy-configs) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Terraform&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Terraform) -[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Packer-templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Packer-templates) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Packer&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Packer) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Ansible&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Ansible) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Environments&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Environments) + +### Monitoring + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugins&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugins) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Nagios-Plugin-Kafka&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugin-Kafka) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Prometheus&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Prometheus) ### Templates [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Templates&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Templates) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Template-repo&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Template-repo) -### Misc +### Desktop + +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=TamperMonkey&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/TamperMonkey) +[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Hammerspoon&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Hammerspoon) + +### Spotify [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-tools&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-tools) [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon&repo=Spotify-playlists&theme=ambient_gradient&description_lines_count=3)](https://github.com/HariSekhon/Spotify-playlists) @@ -217,7 +228,4 @@ The rest of my original source repos are Pre-built Docker images are available on my [DockerHub](https://hub.docker.com/u/harisekhon/). - -![](https://hit.yhype.me/github/profile?user_id=2211051) -