Go Back   Forum Care Forums > Development Reference Area > MySQL Discussion

Reply
 
LinkBack Thread Tools Display Modes
Innodb and auto_increment; BDB engine?
Old
  (#1)
wyo
Guest
 
Posts: n/a
Default Innodb and auto_increment; BDB engine? - 06-04-2007, 06:58 AM

Since I'm redesigning my DB I wanted to switch to Innodb tables, yet
Innodb doesn't allow for auto_increment on secondary primary key
columns. Is there a workaround this problem?

>From the docs the BDB engine should support auto_increment on

secondary primary key columns and transactions. Yet it seems BDB isn't
used very much. Does anybody have experience with the BDB engine?
Performance numbers?

O. Wyss

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Innodb and auto_increment; BDB engine?
Old
  (#2)
lark
Guest
 
Posts: n/a
Default Re: Innodb and auto_increment; BDB engine? - 06-04-2007, 06:58 AM

== Quote from wyo (EMAIL REMOVED)'s article
> Since I'm redesigning my DB I wanted to switch to Innodb tables, yet
> Innodb doesn't allow for auto_increment on secondary primary key
> columns. Is there a workaround this problem?
> >From the docs the BDB engine should support auto_increment on

> secondary primary key columns and transactions. Yet it seems BDB isn't
> used very much. Does anybody have experience with the BDB engine?
> Performance numbers?
> O. Wyss


If you'd like to have access to row level locking and transaction processing, then
Innodb is a good choice for you. Innodb provides some other nice features as well
but these two are the primary features of it.
--
POST BY: PHP News Reader
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Innodb and auto_increment; BDB engine?
Old
  (#3)
Willem Bogaerts
Guest
 
Posts: n/a
Default Re: Innodb and auto_increment; BDB engine? - 06-04-2007, 06:58 AM

> ..., yet
> Innodb doesn't allow for auto_increment on secondary primary key
> columns.


Sorry, I don't understand what you are trying to say. Could you give an
example?

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Innodb and auto_increment; BDB engine?
Old
  (#4)
wyo
Guest
 
Posts: n/a
Default Re: Innodb and auto_increment; BDB engine? - 06-04-2007, 06:58 AM

On May 25, 9:01 am, Willem Bogaerts
<w.bogae...@kratz.maardanzonderditstuk.nl> wrote:
> Sorry, I don't understand what you are trying to say. Could you give an
> example?
>

CREATE TABLE Attribute (
ID INT NOT NULL,
SubID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (ID, SubID),
);

This isn't allowed with InnoDB while MyISAM and according to the docs
BDB does. "SubID" may not use "AUTO_INCREMENT".

O. Wyss

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Innodb and auto_increment; BDB engine?
Old
  (#5)
Willem Bogaerts
Guest
 
Posts: n/a
Default Re: Innodb and auto_increment; BDB engine? - 06-04-2007, 06:58 AM



>> Sorry, I don't understand what you are trying to say. Could you give an
>> example?
>>

> CREATE TABLE Attribute (
> ID INT NOT NULL,
> SubID INT NOT NULL AUTO_INCREMENT,
> PRIMARY KEY (ID, SubID),
> );
>
> This isn't allowed with InnoDB while MyISAM and according to the docs
> BDB does. "SubID" may not use "AUTO_INCREMENT".


I see. You can make SubID the primary key (if you want to) and define a
unique index for the compound key:

CREATE TABLE Attribute (
ID INT NOT NULL PRIMARY KEY,
SubID INT NOT NULL AUTO_INCREMENT,
UNIQUE INDEX (ID, SubID)
);


--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top