Page MenuHomePhabricator

Cannot reliably get the EXPLAIN for a query on analytics wiki replica cluster
Closed, DeclinedPublic

Description

Quarry uses the SHOW EXPLAIN FOR <connection id> method to get the EXPLAINs of queries (ping T50875 T146483)

This method requires the SHOW EXPLAIN FOR being run on the very same host as the one the query is executed, but the analytics cluster is two hosts with a proxy at the front doing round-robin, without a way to force a routing. Therefore SHOW EXPLAIN FOR on a second connection is not very reliable.

What I would like is a reliable method that, given a certain SQL SELECT statement (or preferably allow multiple statements as well, since Quarry allows that), it returns the typical table that EXPLAIN SELECT ... gives.

Event Timeline

jcrespo moved this task from Triage to Backlog on the DBA board.

So the workaround for now is to make sure one is connected to the same server by doing:

SELECT @@GLOBAL.hostname;

This is not an ideal scenario, but it is the only option until we can setup an alternative method that doesn't threaten the High Availability and automatic load balancing architecture. I am open for suggestions, but I don't see an easy option right now.

Vvjjkkii renamed this task from Cannot reliably get the EXPLAIN for a query on analytics wiki replica cluster to f3baaaaaaa.Jul 1 2018, 1:07 AM
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Marostegui renamed this task from f3baaaaaaa to Cannot reliably get the EXPLAIN for a query on analytics wiki replica cluster.Jul 2 2018, 5:18 AM
Marostegui lowered the priority of this task from High to Low.
Marostegui updated the task description. (Show Details)
Marostegui subscribed.

I am going to close this as there is nothing else we can do at the moment as per T195836#4291244
If someone feels this needs to remain open, please reopen.

Also note https://tools.wmflabs.org/sql-optimizer is a thing, which uses some hacky workarounds. Some queries still can't be explained, though, such as those with UNIONs.