Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrolling and wrapping #260

Open
dlax opened this issue Dec 16, 2021 · 6 comments
Open

scrolling and wrapping #260

dlax opened this issue Dec 16, 2021 · 6 comments
Labels

Comments

@dlax
Copy link
Member

dlax commented Dec 16, 2021

As noticed in #239, and described in more details in #257, scrolling is broken when queries are wrapped.

At the moment, I don't see any good solution to this issue: changes from #257 look very strange to me (the list of processes shrinking while one scrolls down and then suddenly being reset upon wrap around).

So I've looked at what htop does:

  • there does not seem to be any wrapping of process commands
  • but one can use right/left arrows to see the line completely
  • and there is a "w" key which displays the complete command of selected process in a dedicated window and wrapped so that everything is visible in the screen (at least horizontally)

Should we do the same in pg_activity?

That would mean drop the various wrapping options (command line flags and key bindings). But it seems to me that having the complete query displayed in a dedicated window could be interesting.

Thoughts?

@dlax dlax added the question label Dec 16, 2021
@dlax dlax linked a pull request Dec 16, 2021 that will close this issue
@blogh
Copy link
Collaborator

blogh commented Dec 16, 2021

I honestly am not fond of the wrapping thing and disable it.

@blogh
Copy link
Collaborator

blogh commented Dec 16, 2021

I like the way htop does it.

It would be cool if we could "find" a little more space on the screen to display more of the unwrapped query.

Maybe having a switch to hide the ["cpu%" "mem%" "Read/s" "Write/s"] would do ?

Or a key to circle between displaying :

  • ["cpu%" "mem%" "Read/s" "Write/s"].
  • ["Waiting" "state" "IOW"]
  • both (as it is now)

@dlax
Copy link
Member Author

dlax commented Dec 16, 2021 via email

@blogh
Copy link
Collaborator

blogh commented Dec 17, 2021

A quick readable summary of the available display modes in pg_activity :

  • -w1 = TRUNCATED
PID    DATABASE                      APP             USER           CLIENT   CPU% MEM%   READ/s  WRITE/s     TIME+          Waiting  IOW              state   Query                          
105855 benches_are_nice          pgbench         postgres            local    0.9  0.5       0B  140.18K  0.249216    transactionid    N             active   UPDATE pgbench_tellers SET tbal
105850 benches_are_nice          pgbench         postgres            local    1.4  0.5       0B  193.21K  0.151634            tuple    N             active   UPDATE pgbench_tellers SET tbal
105875 benches_are_nice          pgbench         postgres            local    1.0  0.5       0B  162.91K  0.124041    transactionid    N             active   UPDATE pgbench_tellers SET tbal
  • -w2 = FULL
PID    DATABASE                      APP             USER           CLIENT   CPU% MEM%   READ/s  WRITE/s     TIME+          Waiting  IOW              state   Query                          
105833 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.204960    transactionid    N             active   UPDATE pgbench_tellers SET
tbalance = tbalance + -1075 WHERE tid = 3;
105878 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.153246    transactionid    N             active   UPDATE pgbench_tellers SET
tbalance = tbalance + 532 WHERE tid = 2;
105861 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.139701    transactionid    N             active   UPDATE pgbench_tellers SET
tbalance = tbalance + -2103 WHERE tid = 5;
  • -w3 = INDENTED
PID    DATABASE                      APP             USER           CLIENT   CPU% MEM%   READ/s  WRITE/s     TIME+          Waiting  IOW              state   Query                          
105877 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.193395            tuple    N             active   UPDATE pgbench_tellers SET
                                                                                                                                                              tbalance = tbalance + 275 WHERE
                                                                                                                                                              tid = 2;
105880 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.140569    transactionid    N             active   UPDATE pgbench_tellers SET
                                                                                                                                                              tbalance = tbalance + 302 WHERE
                                                                                                                                                              tid = 5;
105834 benches_are_nice          pgbench         postgres            local    0.0  0.5       0B       0B  0.130835    transactionid    N             active   UPDATE pgbench_tellers SET
                                                                                                                                                              tbalance = tbalance + -3552
                                                                                                                                                              WHERE tid = 2;

In my opinion :

  • -w2 makes the output unreadable.
  • -w3 works nicely with little queries, but with a big query it's a nightmare also. (plus the screen space for the query is too short)

@gleu
Copy link
Member

gleu commented Dec 17, 2021

I like the way htop does it (at least, what you said it did).

-w1, -w2, and -w3 are great too. They sound like good options to have.

@Krysztophe
Copy link
Contributor

Easy answer: implement all options , as different people will like different things

I personally am rather neutral, as I don't try to read complex queries in pg_activity, the beginning is usually enough to identify them and see what's running and what is blocking. I could change my mind though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@gleu @dlax @blogh @Krysztophe and others