I'm trying to debug a PHP script that runs various queries against the enwiki_p database on the new server (enwiki.analytics.db.svc.eqiad.wmflabs), and I've run into a wall. To simplify the question, I'm running three SQL queries in succession using mysqli_query. The first two queries return results as expected, but the third one doesn't. It just hangs the script indefinitely until the server times out. If I go into the MariaDB client while the script is running and try SHOW FULL PROCESSLIST, it shows the script's connection is sleeping. 

Here's what has me stumped: if I comment out the first two queries and just submit the third, it runs fine and returns the data I am looking for. So I know it's not an error in my query string or in PHP syntax. Am I running up against some limit on successive queries? What should I be doing differently?

If it makes a difference, none of these are extremely slow queries. Each one separately completes in about 30-60 seconds depending on server load. 

Sent from my iPhone