[development] auto_increment

Piotr Krukowiecki piotr at mallorn.ii.uj.edu.pl
Mon Dec 12 10:01:55 UTC 2005


On Mon, Dec 12, 2005 at 12:54:42AM -0800, Knite wrote:
> AUTO_INCREMENT looks like a database feature that is supported in the
> databases that drupal currently supports, namely mysql and pgsql.  From
> what I gather from documentation at mysql.org and from previous comments
> in our forums, it seems that AUTO_INCREMENT is an improvement over the
> current system of creating nid's using the sequence table (and having to
> lock it).
> 
> I'd like to look into moving drupal to use auto-increment instead of
> table locking, for both performance reasons (1 query vs 3) and webhost
> compatibility reasons.  (There are some webhosts that do not grant LOCK
> TABLE permission.)
> 
> Has anyone attempted this conversion before?  Any words of advice?  Is
> this something that's supposed to be left to the core developers?

Go ahead and make a patch. You can make it backward compatibile if you
modify db_next_id() to support AUTO_INCREMENT (if possibile?), and you'll 
probably need to create db_userd_id() or similar, to get the id just
inserted.


-- 
Piotrek
irc: #debian.pl
Mors Drosophilis melanogastribus!


More information about the development mailing list