Debug PostgreSQL | The Dev Tool |

Here we go through many different ways to fix PostgreSQL problems.


To see what queries ran inside Postgresql for the last 10 seconds you can run.

SELECT * FROM pg_stat_activity where query_start > now() - INTERVAL '10 seconds'

This can often help you debug and find problems.

Tables and their associated fields

Run the following command to see schemaname, tablename, tableowner, tablespace, hasindexes, hasrules, hastriggers, and rowsecurity.

SELECT * FROM pg_tables;

Drop all tables

Sometimes the simplest way is to start from scratch. Instead of purging the existing database, you can make a query that drops all tables:

SELECT 'drop table "' || tablename || '" cascade;' FROM pg_tables;

Created by: martin


This page is only partially working without JavaScript. It will show content, but the tools and interactivity cannot be shown without JavaScript enabled. Please enable JavaScript for this page. About Us