Closed (fixed)
Project:
Drush
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Sep 2009 at 19:59 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent
When using drush sql cli, table names do not autocomplete because mysql is invoked with "-A" (--no-auto-rehash). The mysql command line tool asserts you can "get a quicker startup with -A", however real-world testing shows the speed difference is insignificant.
5000 invocations, MySQL query cache off, large-ish drupal site with 150 tables and about 130MB of disk space used.
Using expect to simulate interactive mode, the cost of --auto-rehash was 0.062 seconds.
When using STDIN (e.g.
drush sql cli < data.sql</code) the cost was 0.000007 seconds. (i.e. unmeasurable).
So it would seem that not only is the startup time small, <code>mysqlseems smart enough to detect when STDIN is present, and suppress the rehash so there is no startup cost at all in that case.
| Comment | File | Size | Author |
|---|---|---|---|
| drush_mysql_auto_rehash.patch | 755 bytes | grendzy | |
| auto-rehash-benchmark.sh_.txt | 373 bytes | grendzy |
Comments
Comment #1
moshe weitzman commentedPerhaps startup time only matters for servers with many tables. Please benchmark this case.
Comment #2
moshe weitzman commentedOh, I missed your statement about 150 tables. I'm OK with this change. Anyone else care to comment?
Comment #3
grendzy commentedHeh, I was about to ask how many tables would be enough? Certainly someone doing table prefixing with a multi-site install could see far more.... but that would be doing it wrong.
Should we consider making it configurable via drushrc, similar to #518184: Allow Users To Set myqldump Arguments In drushrc.php (for drush sql dump) ? FWIW, I would also like to add
default-character-set=utf8.Comment #4
rsvelko commentedto sum up:
1. we want to be able to add some defaul sql options in the drushrc
2. this issue here suggests that we add 2 more default options for "sql cli" :
--default-character-set=utf8.
--auto-rehash
please follow the progress of #518184: Allow Users To Set myqldump Arguments In drushrc.php (for drush sql dump) form now on - this thread's patch will be there too
Comment #5
rsvelko commentedplease review the patch in http://drupal.org/node/518184#comment-2061370
Comment #6
moshe weitzman commentedI removed the -A. Committed.