[development] Database queries on drupal.org

Larry Garfield larry at garfieldtech.com
Fri Jul 28 18:06:41 UTC 2006


On Fri, July 28, 2006 11:58 am, Kieran Lal said:
>
> On Jul 28, 2006, at 8:49 AM, Larry Garfield wrote:
>
>> - Flushing the cache is non-cheap.  I recall a while back someone
>> mentioning MySQL's "deferred" functionality, which could be useful
>> here.
>> (If it takes an extra half-second for a cache-flush to commit, that's
>> probably not a problem for the business logic.)
>
> Right.  The key here is that we do not use auto-increment in this
> table.  MySQL inserts and deletes assume auto-increments and there
> are some optimizations that can be done with the LOW-PRIORITY or
> QUICK for the DELETE command.
>
>> 147.989	1.08	137	cache_get	DELETE FROM cache WHERE expire != D
>
> Could be:
> 	delete quick from cache where expire!=D;
> 	optimize cache;
>
> It's been suggested that Drupal can support conditional non-ANSI SQL
> statements that at DB specific.  Not sure how to check for MySQL
> version and if that should be done only once so we can run MySQL
> specific queries.
>
> Cheers,
> Kieran

My thought would be something like db_query_lowpri().  The MySQL version
of that would do the necessary modifications before running db_query()
(INSERT DELAYED vs DELETE QUICK, or whatever), while the Postgres version
would simply pass it straight through (or do Postgres-specific "run this
whenever" modifications, about which I know nothing).

Dries has already vetoed dedicated insert and delete API functions, which
would have been the perfect place for a low-priority flag parameter. :-(

--Larry Garfield



More information about the development mailing list