- http://www.postgresql.org/docs/9.3/static/auto-explain.htmlhttp://www.postgresql.org/…./auto-explain.html
- http://explain.depesz.com/
- http://stackoverflow.com/questions/722221/how-to-log-postgres-sql-querieshttp://stackoverflow.com/….
- https://drupal.org/node/560192
- Servidor gratuito para testes
- Comandos e Consultas uteis
- Base64
- (encode(bytea(?), ‘base64’)
- PostGIS
- Transações
- Foreign Data Wrapper
- https://wiki.postgresql.org/wiki/Foreign_data_wrappershttps://wiki.postgresql.org/….
- https://thoughtbot.com/blog/postgres-foreign-data-wrapperhttps://thoughtbot.com/….
- https://www.progress.com/tutorials/jdbc/querying-external-data-from-postgresql-using-jdbc-fdwhttps://www.progress.com/….
- https://github.com/atris/JDBC_FDW
- Ver tamanho dos bancos de dados existentes
SELECT pg_database.datname as "database_name", pg_size_pretty(pg_database_size(pg_database.datname))
FROM pg_database
ORDER by pg_database_size(pg_database.datname) DESC;
- Espaço ocupado pelas tabelas
SELECT *, pg_size_pretty(total_bytes) AS total , pg_size_pretty(index_bytes) AS INDEX , pg_size_pretty(toast_bytes) AS toast , pg_size_pretty(table_bytes) AS TABLE FROM ( SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME , c.reltuples AS row_estimate , pg_total_relation_size(c.oid) AS total_bytes , pg_indexes_size(c.oid) AS index_bytes , pg_total_relation_size(reltoastrelid) AS toast_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r' ) a ) a order by total_bytes;
- Ver queries ativas
SELECT pid, age(clock_timestamp(), query_start), usename, client_addr, wait_event, state, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;