Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql)
От | Gurjeet Singh |
---|---|
Тема | Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql) |
Дата | |
Msg-id | CABwTF4U+N5oi2TmWzCEAVpWb5kM3V4jqcLFczDhcPypTrkqejQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql) (Kirk Wolak <wolakk@gmail.com>) |
Ответы |
Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql)
|
Список | pgsql-hackers |
On Thu, Feb 23, 2023 at 8:42 PM Kirk Wolak <wolakk@gmail.com> wrote: > I love that my proposal for %T in the prompt, triggered some great conversations. > > This is not instead of that. That lets me run a query and come back HOURS later, and know it finished before 7PM likeit was supposed to! Neat! I have this info embedded in my Bash prompt [1], but many a times this is not sufficient to reconstruct the time it took to run the shell command. > This feature is simple. We forget to set \timing on... > We run a query, and we WONDER... how long did that take. And so I empathize with this need. I have set my Bash prompt to show me this info [2].This info is very helpful in situations where you fire a command, get tired of waiting for it and walk away for a few minutes. Upon return it's very useful to see exactly how long did it take for the command to finish. > I am not sure the name is right, but I would like to report it in the same (ms) units as \timing, since there is an implicitrelationship in what they are doing. > > I think like ROW_COUNT, it should not change because of internal commands. +1 > So, you guys +1 this thing, give additional comments. When the feedback settles, I commit to making it happen. This is definitely a useful feature. I agree with everything in the proposed UI (reporting in milliseconds, don't track internal commands' timing). I think 'duration' or 'elapsed' would be a better words in this context. So perhaps the name could be one of :sql_exec_duration (sql prefix feels superfluous), :exec_duration, :command_duration, or :elapsed_time. By using \timing, the user is explicitly opting into any overhead caused by time-keeping. With this feature, the timing info will be collected all the time. So do consider evaluating the performance impact this can cause on people's workloads. They may not care for the impact in interactive mode, but in automated scripts, even a moderate performance overhead would be a deal-breaker. [1]: https://github.com/gurjeet/home/blob/08f1051fb854f4fc8fbc4f1326f393ed507a55ce/.bashrc#L278 [2]: https://github.com/gurjeet/home/blob/08f1051fb854f4fc8fbc4f1326f393ed507a55ce/.bashrc#L262 Best regards, Gurjeet http://Gurje.et
В списке pgsql-hackers по дате отправления: