Search code examples
amazon-web-servicesamazon-redshiftamazon-quicksight

How to get query that is internally executed by quicksight on redshift?


I am using quicksight as the BI tool on top of redshift.

I can run explain on the queries that I run on redshift thorugh sql client.

I want to know how can I get the query that is executed by quicksight on redshift so that I can get the result of explain command on that query hence optimize my data arrangement on redshift.


Solution

  • if you run your quicksight query then immediately in redshift run

    select query, trim(querytxt) as sqlquery
    from stl_query
    order by query desc limit 50;
    

    you should be able to see your query there.

    you can then copy it and paste it into a sql ide of your choice and run it / explain it.