-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Importing dumps with drush sql:cli can be very slow #6319
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
Conversation
|
Nice find. I see that one of the sites I inherited actually suffers from this exact problem. Our speed difference is more like 50% - not quite as dramatic as yours. I see two possible approaches:
|
|
Based on #4092, I summon @danepowell and @greg-1-anderson for an opinion on how to proceed. |
|
sql:cli is so problematic, I wouldn't mind seeing it deprecated. If this PR makes life a little easier for folks in the meantime, I don't see a problem with it (I haven't reviewed it technically). @harlor just curious, long-term, is Moshe's suggestion of using sql:connect in a subshell viable for your use case? |
|
Oh TBH, I wasn't aware that What would be the recommended way to handle (hide) the password? Depending on the version, mysql complains about the command with:
|
|
That tip has been shown for a decade without any significant concern. My understanding is that MySQL is warning you in case you have a shared server - others can see the DB password briefly on the process list. Shared servers are much less common now with Docker providing isolation for process list and much else. |
|
I'm inclined to change this just with documentation as per #6333. The fix here is a bit invasive IMO. I added a warning log message when you use the slow approach. |
|
I am working another large site and it too suffers from using sql:cli. Reopening this to block the slow approahc in Drush 14. |
|
Very interesting indeed! but why is this being fixed in drush instead of symfony/process? |
|
I blocked pipeing to sql:cli in 14.x. See #6436 |
We've noticed that importing a dump using
drush sql:cliis significantly slower than usingmysqldirectly. After some investigation we found out that this seems to be caused by the buffering in PHP.In a specific use case we measured the following times:
drush sqlc: 3min 39s
mysql: 19s
In this PR we improve the performance by using the
passthru()function in case of the non-interactive mode (e.g. piped SQL dump).