3 ms·
what is your setup to save queries in file and run them, does psql support this model i use ssms for mssql, and i have a large solution with multiple projects
by systems 6y ago
what is your setup to save queries in file and run them,
does psql support this model
i use ssms for mssql, and i have a large solution with multiple projects
i know datagrip can be used in the same way as ssms, but can you this be done using psql
- sbuttgereit 6y agoYou can use the .psqlrc for this purpose, though I suppose you could also real that in via a file on demand, too. You make entries something like: \set show_slow_queries 'SELECT (total_time / 1000 / 60) as total_minutes, (total_time/calls) as average_time, query FROM pg_stat_statements ORDER BY 1 DESC LIMIT 100;' (got from https://www.craigkerstiens.com/2013/02/21/more-out-of-psql/ https://www.craigkerstiens.com/2013/02/21/more-out-of-psql/) and then later at the command prompt you access it as; ":show_slow_queries". I have a few system queries like this in my .psqlrc file, but I don't do much which this feature often truth be told. I have a pretty strong knowledge of the database schema I work with, I do a lot of work on systems I don't regularly control so its not dependably available, and readline history suffices for more immediate needs.