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

pager config #881

Closed
schmeic opened this issue Jul 17, 2020 · 5 comments · Fixed by #1074
Closed

pager config #881

schmeic opened this issue Jul 17, 2020 · 5 comments · Fixed by #1074
Labels

Comments

@schmeic
Copy link

schmeic commented Jul 17, 2020

First some background. I noticed that queries returning 100+ rows were very slow (20+ seconds) compared to mysql cli, so I searched the issues and found issue #873. Following advice in that issue, I gave the pspg pager a try, but with:
table_format = psql
there was no real difference in query time. Switching to:
table_format = csv
made things much faster, very similar to the native mysql cli. The only problem is that the pager isn't always used, so for queries that don't return enough rows, I'm stuck looking at raw csv data.
So maybe an option to always use the pager? Or possibly just determine this based on the table_format and pager settings?

I'd also like to point out that it would be really helpful to be able to set pager in the .myclirc file (I know this is mentioned in #581). In this case, I need to use pager = pspg --csv, which won't work with mysql, so I can't put this in my.cnf, but it also means that I can't use a pager at all with the native mysql cli if I use this setup (unless I manually set pager each time I run mycli). Ideally, setting the pager in .myclirc should override any setting in my.cnf. Obviously, globally setting the env PAGER='pspg --csv' isn't a good idea, so I've ended up writing a little shell script that sets PAGER and then runs mycli.

@schmeic schmeic changed the title option to always use pager pager config Jul 20, 2020
@amjith
Copy link
Member

amjith commented Jul 25, 2020

Valid point. We should add a config option for pager in myclirc. I'll see what I can do.

@amjith amjith added the easy label Jul 25, 2020
@schmeic
Copy link
Author

schmeic commented Jul 28, 2020

Adding the pager config would be great, but fixing the extreme slowness would be even better. Is there any reason this fix hasn't been merged?

dbcli/cli_helpers#66

@amjith
Copy link
Member

amjith commented Jul 29, 2020

A new version of cli_helpers is now released. It has the optimization.

@amjith
Copy link
Member

amjith commented Jul 29, 2020

You can update using pip install -U cli_helpers

@schmeic
Copy link
Author

schmeic commented Jul 29, 2020

Thanks. I've updated and verified that a query that used to take over 20 seconds now runs almost instantly using the default table_format = ascii.

BuonOmo added a commit to BuonOmo/mycli that referenced this issue Aug 22, 2022
For instance `pager = 'pspg --csv'`.

Fixes dbcli#881
BuonOmo added a commit to BuonOmo/mycli that referenced this issue Aug 22, 2022
For instance `pager = 'pspg --csv'`.

Fixes dbcli#881

Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
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.

2 participants