On Wed, Oct 26, 2011 at 6:29 PM, Carl (CBM) <cbm.wikipedia@gmail.com> wrote:
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.

Just a little sidenote, you may be interested in ns_is_favorite. There is one entry per namespace per dbname where `ns_is_favorite = 1` which is also the one used by the wiki when creating/redirecting native links.

- Krinkle