Skip to content

How to catch execution plans for queries

dbacvetkov edited this page Jul 6, 2018 · 8 revisions

With PASH-Viewer you can catch execution plans for your queries. (but maybe not all of them)

Requirements:

  1. In connection settings write the name of the database, you application work with. In my case this is the default "postgres", but probably you use different database name.

  1. If tables, your queries work with, locate in "public" schema, you can left the field Schema blank. Otherwise, put here the name of schema, in which your tables locate. Entered value will be added to search_path of the PASH-Viewer session, to be able to find objects from EXPLAIN command.

  2. After the connection established, choose explain command frequency. If you suspect that the some queries can use different plans, it is better to set higher frequency (10sec) to catch them all. If your application generates a lot of different unique queries (with identical SQLID) and you are worried about consuming CPU (for EXPLAIN command), then set lower frequency (10min, default).

  1. After that wait while your query appears in the Top SQL, click on it and go to the SQL Plan tab. In this example i have caught two different plans, because in my test_table i have 1 record for id=1 and ~10000 records for id=2.