Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorhaakon
     
    Hi,

    I'm using Akelos with MySQL database backend, and I noticed that Akelos is using "SHOW COLUMNS FROM" very very thoroughly...
    When testing a page which generates 7 SQL queries total from 3 different tables. It also generates 21 "SHOW COLUMNS FROM" queries.

    I know that with mysql query caching, etc etc, this has not much impact on mysql performance, but when the MySQL server is physically separated from the server running Akelos, there will be a lot of extra 'overhead' from queries that it really already knows the answer for.

    So I wrote this patch, which fixes this for the MySQL driver.. Might be applicable for other databases as well.. So I post it here, to hear if anyone have any different views on if this is a bad idea or not.. I'm sure there should be some kind of "clear cache" functionality if this driver is used by the migrate scripts, etc. But except from that, I don't think this should be that bad idea? The page I mentioned went from 21 SHOW COLUMNS" queries, to 3.

    Index: vendor/adodb/drivers/adodb-mysql.inc.php
    ===================================================================
    --- vendor/adodb/drivers/adodb-mysql.inc.php (revision 1249)
    +++ vendor/adodb/drivers/adodb-mysql.inc.php (working copy)
    @@ -19,6 +19,7 @@
    define("_ADODB_MYSQL_LAYER", 1 );

    class ADODB_mysql extends ADOConnection {
    + var $columnCache = Array();
    var $databaseType = 'mysql';
    var $dataProvider = 'mysql';
    var $hasInsertID = true;
    @@ -380,6 +381,10 @@

    function MetaColumns($table)
    {
    + if (isset($this->columnCache[$table])) {
    + return $this->columnCache[$table];
    + }
    +
    $this->_findschema($table,$schema);
    if ($schema) {
    $dbName = $this->database;
    @@ -453,6 +458,7 @@
    }

    $rs->Close();
    + $this->columnCache[$table] = $retarr;
    return $retarr;
    }
    •  
      CommentAuthorbermi
     

    Hi haakon,

    Akelos does cache table schema on production mode by default.

    On rev.1245 the caching was improved for development mode ass well. This has some drawbacks. You'll need to use migrations to get rid of cached schemes, but that's a good practice as it is the same mechanism used refreshing cache on production mode.

    Did this issue happened on the trunk version?

    • CommentAuthorhaakon
     
    Hi,

    I always use migrate, and i'm using the lastes rev from trunk. Still I had this "problem". But I was not aware that it was only in development mode. I have not yet tried in production.