pev icon indicating copy to clipboard operation
pev copied to clipboard

Adding data as part of query parameters

Open sveint opened this issue 8 years ago • 2 comments

Hi,

Maybe this exists already, but I couldn't find any information about it.

Would it be possible to add two query parameters, so that one could submit the ANALYZE json data and they SQL query as part of the URL? Then the app could read in the data (in the client), and use that instead of having to copy paste it.

My use case is that I have an explain() function for debugging in the app, then I'd like it to just print out a prepared URL that I can click on which will open the public (or local if one prefer) pev instance and show me the data. Although the URLs would be long, that shouldn't pose any issues in modern browsers.

Example:

http://tatiyants.com/pev/#/plans?analyze=%5B%7B%22Execution%20Time%22%3A%200.783%2C%20%22Planning%20Time%22%3A%200.081%2C%20%22Plan%22%3A%20%7B%22Node%20Type%22%3A%20%22Index%20Only%20Scan%22%2C%20%22Actual%20Total%20Time%22%3A%200.754%2C%20%22Shared%20Hit%20Blocks%22%3A%202%2C%20%22Schema%22%3A%20%22public%22%2C%20%22Scan%20Direction%22%3A%20%22Forward%22%2C%20%22Shared%20Read%20Blocks%22%3A%200%2C%20%22Relation%20Name%22%3A%20%22user%22%2C%20%22Local%20Hit%20Blocks%22%3A%200%2C%20%22Heap%20Fetches%22%3A%201%2C%20%22Local%20Dirtied%20Blocks%22%3A%200%2C%20%22Temp%20Written%20Blocks%22%3A%200%2C%20%22Plan%20Width%22%3A%204%2C%20%22Total%20Cost%22%3A%208.17%2C%20%22Rows%20Removed%20by%20Index%20Recheck%22%3A%200%2C%20%22Actual%20Startup%20Time%22%3A%200.751%2C%20%22Alias%22%3A%20%22user%22%2C%20%22Temp%20Read%20Blocks%22%3A%200%2C%20%22Output%22%3A%20%5B%22id%22%5D%2C%20%22Local%20Read%20Blocks%22%3A%200%2C%20%22Index%20Name%22%3A%20%22pk_user%22%2C%20%22Startup%20Cost%22%3A%200.15%2C%20%22Shared%20Dirtied%20Blocks%22%3A%200%2C%20%22Shared%20Written%20Blocks%22%3A%200%2C%20%22Local%20Written%20Blocks%22%3A%200%2C%20%22Plan%20Rows%22%3A%201%2C%20%22Index%20Cond%22%3A%20%22%28%5C%22user%5C%22.id%20%3D%201%29%22%2C%20%22Parallel%20Aware%22%3A%20false%2C%20%22Actual%20Rows%22%3A%201%2C%20%22Actual%20Loops%22%3A%201%7D%2C%20%22Triggers%22%3A%20%5B%5D%7D%5D&query=SELECT%20%22user%22.id%20AS%20user_id%20%0D%0AFROM%20%22user%22%20%0D%0AWHERE%20%22user%22.id%20%3D%20%3Aid_1

sveint avatar Nov 21 '17 11:11 sveint

Solid 👍. This would allow creating a script taking sql file as an input and output an url to pev.

raine avatar Feb 15 '18 22:02 raine

This would work well with Postgres auto_explain

felixfbecker avatar Jan 29 '20 10:01 felixfbecker