Skip to content

Instantly share code, notes, and snippets.

@Rathunter
Rathunter / postgres_queries_and_commands.sql
Created October 30, 2020 19:51 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@Rathunter
Rathunter / psql_useful_stat_queries.sql
Created July 4, 2019 15:00 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@Rathunter
Rathunter / indices_groups.txt
Created June 27, 2018 19:59 — forked from odin793/indices_groups.txt
Indices groups
INDARCX - NYSE ARCA
INDBVMF - Bm_Fbovespa S.A. - Bolsa De Valores, Mercadorias E Futuros
INDCBSX - Cboe Stock Exchange
INDGLBX - CME Globex
INDIFUS - ICE Futures U.S.
INDMTAA - Electronic Share Market
INDRTSX - Standard-Classica-Forts
INDXASE - NYSE Amex Equities
INDXASX - ASX Tradematch
INDXATH - Athens Exchange S.A. Cash Market