Objects used in queries

0

Hello, is there any way to find out the list of all the tables (including external tables) used in the sqls executed in redshift. What I am looking is if there is any view or table which says this query has accessed these tables, if there is such view/table it would be easy to extract the info I am looking for. Otherwise I would need to go query history and manually get the objects accessed in each query.

nmakb
preguntada hace 5 años371 visualizaciones
1 Respuesta
0
Respuesta aceptada

Hi nmakb,

I believe you can construct query or view for what you're looking by basing a query off of a UNION of query system log table pg_catalog.stl_scan jointed to a few other table for all table in Redshift storage UNIONEed with a query of svl_s3query smilarly joined to a few other tables to get the query text and the table and schema name.

Basically stl_scan tracks all table scan operators against table in Redshift storage for in all query plans and svl_s3query effectively does the same because all Spectrum sub-queries are single table in nature and produce equivalent scan results returned to the slices from the Spectrum layer.

I hope this helps you develop the result set you're looking for.

Regards,
-Kurt

klarson
respondido hace 5 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas