Re: Auto_increment or manual??
Personnaly, i have found autoincrement fields to be rock solid. I use'em all over the place on a 1 Gb database, web based. Don't do it manually . You'll end up doing the same thing that mysql gives you for free. Christopher Lambrou, CGL Computer Services, Inc. Empire State Building, PMB 16J Suite 3304 New York, NY 10118 Tel: (212) 971-9723 Fax: (212) 564-1135 URL: http://www.cglcomputer.com Email: [EMAIL PROTECTED] On 5/3/2001 15:57:38, you said: Hello! I have a database with about 10 tables in it. In every table I have a RECORD_ID field so that I can at least uniquely identify a row if I need to, also its used in relationships. The question is should I use the AUTO_INCREMENT for this, or should I manually generate this value, getting the next highest number, then putting it in there. Is there any known replication problems if I use AUTO_INCREMENT??? Would I be safer in just doing this manually myself in my code?? This is going to be a web-based app, so many users will be using the db at the same time. Thanks! Patrick - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Auto_increment or manual??
This sounds encouraging, but are there any known problems with the MySQL replication model currently available?? Would the slave servers have the same auto_inc column attributes? Could this conflict somehow with the master server?? Thanks for the quick reply! Patrick # Personnaly, i have found autoincrement fields to be rock solid. # I use'em all over the place on a 1 Gb database, web based. # Don't do it manually . You'll end up doing the same thing # that mysql gives you for free. # # Christopher Lambrou, # CGL Computer Services, Inc. # Empire State Building, # PMB 16J Suite 3304 # New York, NY 10118 # Tel: (212) 971-9723 # Fax: (212) 564-1135 # URL: http://www.cglcomputer.com # Email: [EMAIL PROTECTED] # # On 5/3/2001 15:57:38, you said: # Hello! # I have a database with about 10 tables in it. In every table I have a # RECORD_ID # field so that I can at least uniquely identify a row if I # need to, also its # used in relationships. The question is should I use the # AUTO_INCREMENT for # this, or should I manually generate this value, getting the # next highest # number, then putting it in there. Is there any known # replication problems if # I use AUTO_INCREMENT??? Would I be safer in just doing this # manually myself # in my code?? This is going to be a web-based app, so many # users will be # using the db at the same time. # Thanks! # # Patrick # # - # Before posting, please check: #http://www.mysql.com/manual.php (the manual) #http://lists.mysql.com/ (the list archive) # # To request this thread, e-mail [EMAIL PROTECTED] # To unsubscribe, e-mail # [EMAIL PROTECTED] # Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: RE: Auto_increment or manual??
For replication, yes, there will be a problem, but this has anything to do with mysql. You'd have the same problem with a Sybase identity field replicated to another database server. A possible solution is this: 1. have a separate table for generating counter fields. 2. make the replicated table's primary key char 3. Identify each replicated server with a character. For example, we have a server in NY that's identified with an 'N' and one in Miami, that's an 'M'. 4. When inserting a record get the next counter value from the counter table, concatenate it with the server identifier and voila, a key that's unique across replicated servers. NY server ids will look like N1000, N1001, N1002 and Miami M1000, M1001, M1002 and so on. The downside: you have a char field to index and that ain't as fast as an index on a numeric field. Christopher Lambrou, CGL Computer Services, Inc. Empire State Building, PMB 16J Suite 3304 New York, NY 10118 Tel: (212) 971-9723 Fax: (212) 564-1135 URL: http://www.cglcomputer.com Email: [EMAIL PROTECTED] On 5/3/2001 18:03:17, you said: This sounds encouraging, but are there any known problems with the MySQL replication model currently available?? Would the slave servers have the same auto_inc column attributes? Could this conflict somehow with the master server?? Thanks for the quick reply! Patrick # Personnaly, i have found autoincrement fields to be rock solid. # I use'em all over the place on a 1 Gb database, web based. # Don't do it manually . You'll end up doing the same thing # that mysql gives you for free. # # Christopher Lambrou, # CGL Computer Services, Inc. # Empire State Building, # PMB 16J Suite 3304 # New York, NY 10118 # Tel: (212) 971-9723 # Fax: (212) 564-1135 # URL: http://www.cglcomputer.com # Email: [EMAIL PROTECTED] # # On 5/3/2001 15:57:38, you said: # Hello! # I have a database with about 10 tables in it. In every table I have a # RECORD_ID # field so that I can at least uniquely identify a row if I # need to, also its # used in relationships. The question is should I use the # AUTO_INCREMENT for # this, or should I manually generate this value, getting the # next highest # number, then putting it in there. Is there any known # replication problems if # I use AUTO_INCREMENT??? Would I be safer in just doing this # manually myself # in my code?? This is going to be a web-based app, so many # users will be # using the db at the same time. # Thanks! # # Patrick # # - # Before posting, please check: #http://www.mysql.com/manual.php (the manual) #http://lists.mysql.com/ (the list archive) # # To request this thread, e-mail [EMAIL PROTECTED] # To unsubscribe, e-mail # [EMAIL PROTECTED] # Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Auto_increment or manual??
http://www.mysql.com/doc/R/e/Replication_Features.html Replication will be done correctly with AUTO_INCREMENT, LAST_INSERT_ID, and TIMESTAMP values. This sounds encouraging, but are there any known problems with the MySQL replication model currently available?? Would the slave servers have the same auto_inc column attributes? Could this conflict somehow with the master server?? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Auto_increment or manual??
Thank you Chris with this info! This will greatly help me out, so as I see it now, there is absolutely no advantage to generating your own unique numbers manually - just let MySQL do it for you am I correct in this assumption? Again, thanks! Patrick # http://www.mysql.com/doc/R/e/Replication_Features.html # # Replication will be done correctly with AUTO_INCREMENT, # LAST_INSERT_ID, and # TIMESTAMP values. # # This sounds encouraging, but are there any known problems # with the MySQL # replication model currently available?? Would the slave # servers have the # same auto_inc column attributes? Could this conflict somehow with # the master # server?? # # # - # Before posting, please check: #http://www.mysql.com/manual.php (the manual) #http://lists.mysql.com/ (the list archive) # # To request this thread, e-mail [EMAIL PROTECTED] # To unsubscribe, e-mail # [EMAIL PROTECTED] # Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php # - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Auto_increment or manual??
Yes, I know from experience, it's the best way to do it. And if you need to get the number generated by an auto_increment column in an insert, you can use last_insert_id() (or mysql_insert_id() with php). Thank you Chris with this info! This will greatly help me out, so as I see it now, there is absolutely no advantage to generating your own unique numbers manually - just let MySQL do it for you am I correct in this assumption? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php