Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    1

    Unanswered: 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.

  2. #2
    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?

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •