Combining stv_tbl_perm, pg_class and stl_query to get queries ran against tables with 0 rows RedShift SQL PostgreSQL
I am trying to combine stv_tbl_perm,pg_class and stl_query to get queries ran against tables with 0 rows using EXISTS. Current Query SELECT z.* FROM stl_query WHERE EXISTS ( SELECT b.relname FROM (SELECT db_id, id, name, MAX(ROWS) rows_all_dist, SUM(ROWS) "rows" FROM…