Skip to content

Instantly share code, notes, and snippets.

@dikshant

dikshant/django Secret

Last active January 30, 2023 05:00
Show Gist options
  • Save dikshant/703f590a996f3666294f5de640c351b7 to your computer and use it in GitHub Desktop.
Save dikshant/703f590a996f3666294f5de640c351b7 to your computer and use it in GitHub Desktop.
django.sql
root@localhost:26257/defaultdb> EXPLAIN ANALYZE SELECT
c.relname,
CASE
WHEN c.relispartition THEN 'p'
WHEN c.relkind IN ('m', 'v') THEN 'v'
ELSE 't'
END,
obj_description(c.oid, 'pg_class')
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('f', 'm', 'p', 'r', 'v')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid);
info
---------------------------------------------------------------------------------------------
planning time: 62ms
execution time: 2m7s
distribution: local
vectorized: true
maximum memory usage: 3.8 MiB
network usage: 0 B (0 messages)
regions: us-east4
• render
└── • filter
│ nodes: n1
│ regions: us-east4
│ actual row count: 14,862
│ filter: nspname NOT IN ('pg_catalog', 'pg_toast')
└── • hash join (right outer)
│ nodes: n1
│ regions: us-east4
│ actual row count: 14,991
│ estimated max memory allocated: 3.1 MiB
│ estimated max sql temp disk usage: 0 B
│ equality: (oid) = (relnamespace)
├── • virtual table
│ nodes: n1
│ regions: us-east4
│ actual row count: 5
│ table: pg_namespace@primary
└── • filter
│ nodes: n1
│ regions: us-east4
│ actual row count: 14,991
│ filter: (relkind IN ('f', 'm', 'p', 'r', 'v')) AND pg_table_is_visible(oid)
└── • virtual table
nodes: n1
regions: us-east4
actual row count: 30,024
table: pg_class@primary
(41 rows)
Time: 127.272s total (execution 127.265s / network 0.006s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment