the following query of mine was killed after 1700 seconds:
SELECT ns_id, ns_name FROM toolserver.namespacename where (ns_type = 'canonical' or ns_type = 'primary') and dbname = 'enwiki_p'
That should be an extremely fast query; there is an index on dbname.