If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Shared pool for row-Ids

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-30-06, 00:20
jogi_zogi jogi_zogi is offline
Registered User
 
Join Date: May 2006
Posts: 1
Shared pool for row-Ids

Hi there,
I have a problem and would really appreciate if someone can help me with that. I am trying to create some tables in mysql. I want that all the new rows created for any table should come from single row-id pool. I will be more precise here. What i want is that when i create a new row doesnt matter which table it is, the row Id should be incremental to the previous row id (same or someother table). This way all the rowids of all the tables will be unique. Is there a way in MYSQL to do it.
Reply With Quote
  #2 (permalink)  
Old 05-31-06, 02:17
snorp snorp is offline
Registered User
 
Join Date: Apr 2004
Location: Europe->Sweden->Stockholm
Posts: 71
Why?

Under what circumstances do you find this arrangement necessary? Do you have data spread over several tables?
Reply With Quote
  #3 (permalink)  
Old 05-31-06, 10:17
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
is there a way? yes, but you don't really want to go there

set up a new table with an auto_increment id

then, any time you want to obtain a new row_id, lock this table, insert a row, grab the generated auto_increment value, use it to insert the new row for your other table, then come back to the auto_increment table and delete the row you just inserted (so that this table doesn't grow in size), then unlock the table

this will give you what you want, but make your application perform quite poorly
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On