ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Show Tables From

January 09, 2009 3:29pm

Subscribe [4]
  • #1 / Jan 09, 2009 3:29pm

    Cameron Corda

    31 posts

    There is a method called ‘table_exists’ in EE that, well, checks to see if a table exists.  This is done by doing this query:

    SHOW TABLES FROM ‘client’ LIKE ‘exp_%’

    There seems to be quite alot of these ‘show tables from’ queries in the process list for several clients….

    After a quick grep, I see several areas in the EE code that will call this method and end up running that query.

    Can someone shed some light on this query and why it’s run so much?  Any way to disable or speed it up?

  • #2 / Jan 09, 2009 4:21pm

    Sue Crocker

    26054 posts

    Cameron, this query is found in db.mysql.php around line 454:

    // mysql_list_tables() was depreciated, so we switched to using
            // this query, which should work. -Paul
            
            $query = $this->query("SHOW TABLES FROM `{$this->database}` LIKE '{$this->exp_prefix}%'"); // We use $this->exp_prefix as query() will convert it

    As far speeding things up goes, I’ll ask the programming team.

  • #3 / Jan 12, 2009 2:25pm

    Robin Sowell

    13255 posts

    Typically that query will very rarely be run (from searching on it and fetch_tables)- it was used in the old database backup routine- which if someone still had that in place and was running it via cron, I can see it cropping up a bit.

    In truth, that’s about the only way I’m spotting it being something that happens with any frequency.  Which one(s) in particular leaped out at you in the grep?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases