You can now add query to your plan on

Quite a lot of people have been bugging me about it, and finally got some time, and worked on it.

Long story short – it works.

You can add your query below plan (in separate text area), and then it will be displayed as one of tabs

For example, check this plan.

It also works sensibly-ish, if you want to obfuscate your plans, as you can see here.

In case you're interested in technical details …

Whole work is in three commits:

  1. initial commit adding support for obfuscation of queries in Pg::Explain library
  2. bugfix for missing whitespace in queries after obfuscation
  3. site changes, including:
    • db schema change
    • support for adding queries
    • support for display of queries

Hope you'll find it useful.

2 thoughts on “You can now add query to your plan on”

  1. Cool new feature! However, the obfuscation still seem to need some more love, even if you only advertise it as working sensibly-ish 😉

    I see three issues: (using the examples mentioned above vs.
    1. string literals in the projection are not obfuscated at all
    2. string literals replaced by obfuscated identifiers ` ‘pg_catalog’` -> ` sierra_oscar` as this is completely altering the meaning of the query, this should be seen as a bug. The obfuscation in the plan does get this correct and even with the same obfuscation word: `(xray ‘sierra_oscar’::name)`
    3. different obfuscation between plan `= ANY (‘{r,p,v,m,S,f,””}’::”char”[])` -> `= ANY (‘golf’::”char”[])` and query `IN (‘r’,’p’,’v’,’m’,’S’,’f’,”)` (not obfuscated) but as the expression was rewritten, it is likely hard to match these, so see 1.

    Anyhow, thank you for the very helpful tool!

  2. @Tobias:
    sorry for lag – vacation.
    Unfortunately anonymizing queries is a bit more complex, and can’t be done *well* without writing SQL parser. Which I’m not up to, at lease for now.

Comments are closed.