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

Log something on slow queries #293

Open
dpordomingo opened this issue Mar 6, 2019 · 1 comment
Open

Log something on slow queries #293

dpordomingo opened this issue Mar 6, 2019 · 1 comment
Labels
empathy-sessions Issue filed as as part of empathy sessions enhancement New feature or request triage/needs-product-input

Comments

@dpordomingo
Copy link
Contributor

discovered at https://github.com/src-d/empathy-sessions/issues/37
related to https://github.com/src-d/engine/issues/271
related to https://github.com/src-d/engine/issues/279

If a query takes a lot with no output at all until it finishes, the user can think that something was broken.

I wonder if we could let the user know that something is being processed. For example adding the spinner we already added when starting gitbase on src-d/sourced-ce#216

$ srcd sql "SELECT cf.file_path,
    LANGUAGE(f.file_path,  f.blob_content) as lang
FROM ref_commits r
NATURAL JOIN commit_files cf
NATURAL JOIN files f
WHERE r.ref_name = 'HEAD'
AND r.history_index = 0;"

I wonder if SHOW PROCESSLIST could give some info about the process. I saw that while running a slow query in background, files field keeps growing until the query finish.
I think that files field represents the number of repositories, or sivas being processed... or at least it matched that number in a couple of tests.

$ srcd sql 'SHOW PROCESSLIST;'
+----+------+--------------------+---------+---------+------+--------------+--------------------------------+
| ID | USER |        HOST        |   DB    | COMMAND | TIME |    STATE     |              INFO              |
+----+------+--------------------+---------+---------+------+--------------+--------------------------------+
| 44 | root | 192.168.96.2:34616 | gitbase | query   |    0 | running      | SHOW PROCESSLIST;              |
|  4 | root | 192.168.96.2:34616 | gitbase | query   |  151 | files(17/34) | SELECT count(*) as count       |
|    |      |                    |         |         |      |              | FROM files                     |
|    |      |                    |         |         |      |              | WHERE language(file_path,      |
|    |      |                    |         |         |      |              | blob_content) = 'Go'           |
|    |      |                    |         |         |      |              | LIMIT 50;                      |
+----+------+--------------------+---------+---------+------+--------------+--------------------------------+
@dpordomingo dpordomingo added enhancement New feature or request empathy-sessions Issue filed as as part of empathy sessions labels Mar 6, 2019
@carlosms
Copy link
Contributor

related: #121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
empathy-sessions Issue filed as as part of empathy sessions enhancement New feature or request triage/needs-product-input
Projects
None yet
Development

No branches or pull requests

2 participants