RE: Unique index - opinions sought

2012-07-16 Thread Rick James
ssage- > From: Mark Goodge [mailto:m...@good-stuff.co.uk] > Sent: Monday, July 16, 2012 10:13 AM > To: Mysql General List > Subject: Re: Unique index - opinions sought > > On 16/07/2012 17:39, Rick James wrote: > > How many rows? If 1K, it does not matter. If 1

Re: Unique index - opinions sought

2012-07-16 Thread Mark Goodge
On 16/07/2012 17:39, Rick James wrote: How many rows? If 1K, it does not matter. If 1 billion, we need to discuss in more detail. Let's assume 1M... Around 1M in the item_spine table and 10M in item_detail. Dates should be stored in DATE datatype, which is 3 bytes. Your GUID is non-standa

RE: Unique index - opinions sought

2012-07-16 Thread Rick James
How many rows? If 1K, it does not matter. If 1 billion, we need to discuss in more detail. Let's assume 1M... Dates should be stored in DATE datatype, which is 3 bytes. Your GUID is non-standard, but should probably be stored in CHAR(6) CHARACTER SET ascii, unless it is expected to have non-

Re: Unique on non null entries but allowing multiple nulls

2011-10-17 Thread Jigal van Hemert
Hi, On 17-10-2011 15:39, Peng Yu wrote: If I use "NULL UNIQUE" when I create a table, it seems that only one NULL entry is allowed. Since NULL could mean unknown, in this case, two unknowns are not the same and I want to allow multiple nulls but I still want non null entries be unique. Is there

Re: Unique ID's across multiple databases

2010-09-14 Thread Johnny Withers
I may have missed what you are trying to do here. NoSQL is really a bad name and should really be renamed to NoREL instead. NoSQL implementations are not used just because of limitations of traditional RDBMS when it comes to sheer traffic volume, they are also used because they scale horizontally v

Re: Unique ID's across multiple databases

2010-09-13 Thread Johan De Meersman
On Mon, Sep 13, 2010 at 8:59 PM, Johnny Withers wrote: > > This sounds like a good job for a 'NoSQL' system. Maybe? > I can't help but blink at that. How exactly is NoSQL going to fix issues that are related to topology, not inherent SQL limitations ? Which particular incarnation of NoSQL are you

RE: Unique ID's across multiple databases

2010-09-13 Thread Wm Mussatto
On Mon, September 13, 2010 15:37, Daevid Vincent wrote: >> -Original Message- >> From: Kiss D�niel [mailto:n...@dinagon.com] >> Sent: Monday, September 13, 2010 5:59 AM >> >> Well, thanks, but I'm afraid using UUID's (even with hex >> compression) is >> kind of a suicide, when it comes to

RE: Unique ID's across multiple databases

2010-09-13 Thread Daevid Vincent
> -Original Message- > From: Kiss Dániel [mailto:n...@dinagon.com] > Sent: Monday, September 13, 2010 5:59 AM > > Well, thanks, but I'm afraid using UUID's (even with hex > compression) is > kind of a suicide, when it comes to performance. > This is a good summary about the issues: > http

RE: Unique ID's across multiple databases

2010-09-13 Thread Jerry Schwartz
From: Kiss Dániel [mailto:n...@dinagon.com] Sent: Monday, September 13, 2010 3:17 PM To: Jerry Schwartz Cc: Johan De Meersman; Max Schubert; mysql@lists.mysql.com; replicat...@lists.mysql.com Subject: Re: Unique ID's across multiple databases Well, that would be the plan, yes. :-) Anyway,

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
M > >To: Jerry Schwartz > >Cc: Johan De Meersman; Max Schubert; mysql@lists.mysql.com; > >replicat...@lists.mysql.com > >Subject: Re: Unique ID's across multiple databases > > > >Well, not exactly. > > > >I do not own all the databases. Some o

Re: Unique ID's across multiple databases

2010-09-13 Thread Johnny Withers
artz > >Cc: Johan De Meersman; Max Schubert; mysql@lists.mysql.com; > >replicat...@lists.mysql.com > >Subject: Re: Unique ID's across multiple databases > > > >Well, not exactly. > > > >I do not own all the databases. Some of them are placed at customers

RE: Unique ID's across multiple databases

2010-09-13 Thread Jerry Schwartz
>-Original Message- >From: Kiss Dániel [mailto:n...@dinagon.com] >Sent: Monday, September 13, 2010 11:49 AM >To: Jerry Schwartz >Cc: Johan De Meersman; Max Schubert; mysql@lists.mysql.com; >replicat...@lists.mysql.com >Subject: Re: Unique ID's across multiple data

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
;From: vegiv...@gmail.com [mailto:vegiv...@gmail.com] On Behalf Of Johan > De > >Meersman > >Sent: Monday, September 13, 2010 7:27 AM > >To: Kiss Dániel > >Cc: Max Schubert; mysql@lists.mysql.com; replicat...@lists.mysql.com > >Subject: Re: Unique ID's across multip

RE: Unique ID's across multiple databases

2010-09-13 Thread Jerry Schwartz
>-Original Message- >From: vegiv...@gmail.com [mailto:vegiv...@gmail.com] On Behalf Of Johan De >Meersman >Sent: Monday, September 13, 2010 7:27 AM >To: Kiss Dániel >Cc: Max Schubert; mysql@lists.mysql.com; replicat...@lists.mysql.com >Subject: Re: Unique ID's

RE: Unique ID's across multiple databases

2010-09-13 Thread Jerry Schwartz
>-Original Message- >From: Kiss Dániel [mailto:n...@dinagon.com] >Sent: Sunday, September 12, 2010 1:47 PM >To: mysql@lists.mysql.com; replicat...@lists.mysql.com >Subject: Unique ID's across multiple databases > >Hi, > >I'm designing a master-to-master replication architecture. >I wonder w

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
Well, thanks, but I'm afraid using UUID's (even with hex compression) is kind of a suicide, when it comes to performance. This is a good summary about the issues: http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/ So, some kind of auto_increment or sequencing must be the optima

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
Hell, yeah. :) Actually, the ID system I described below works quite well according to my tests. I feel very comfortable with it both from primary key size and dynamically increasable database number point of views. What I actually don't like in it is the concatenated unique ID (ID + SID) pairs. T

Re: Unique ID's across multiple databases

2010-09-13 Thread Fish Kungfu
I had some coffee and realized that actually, using a UUID might be something to look at. There have been quite a few discussions about using a UUID as a unique id and it does have some gotchas. Just Google: mysql uuid Have a great day ~~Fish~~ On Mon, Sep 13, 2010 at 7:30 AM, Fish Kungfu

Re: Unique ID's across multiple databases

2010-09-13 Thread Fish Kungfu
I could be way off here, but how about letting your unique id be a calculated column of the the server's MAC address concatenated with an auto-increment id column? I hope this helps... ~~Fish~~ On Mon, Sep 13, 2010 at 7:26 AM, Johan De Meersman wrote: > Hmm, that's a very interesting scenario,

Re: Unique ID's across multiple databases

2010-09-13 Thread Johan De Meersman
Hmm, that's a very interesting scenario, indeed. One bad connection will break the chain, though, so in effect you'll be multiplying the disconnecting rate... I think you'd be better of with a star topology, but MySQL unfortunately only allows ring-types. This is gonna require some good thinking

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
This is actually more for failover scenarios where databases are spread in multiple locations with unreliable internet connections. But you want to keep every single location working even when they are cut off from the other databases. The primary purpose is not load distribution. On Mon, Sep 13,

Re: Unique ID's across multiple databases

2010-09-13 Thread Johan De Meersman
On Sun, Sep 12, 2010 at 9:45 PM, Kiss Dániel wrote: > offset + increment thingy is good if you know in advance that you'll have a > limited number of servers. But if you have no idea that you will have 2, > 20, > or 200 servers in your array in the future, you just can't pick an optimal > What b

Re: Unique ID's across multiple databases

2010-09-12 Thread Kiss Dániel
You may be right. I'm not arguing that offset + increment is working. I'm just wondering if that's the optimal solution when you do not know how many servers you will have in your array in the future. In my view, the offset + increment thingy is good if you know in advance that you'll have a limit

Re: Unique ID's across multiple databases

2010-09-12 Thread Max Schubert
Server offset + increment works really well, is simple, and well documented and reliable - not sure why you would want to re-invent something that works so well :). -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=

Re: Unique ID's across multiple databases

2010-09-12 Thread Marcus Bointon
On 12 Sep 2010, at 19:47, Kiss Dániel wrote: > - SID adds only 2 bytes in this case to the size of the primary key item. > It can be even 1 byte if I'm sure I'll never exceed maximum 255 servers. But > anyhow, it is still way smaller than the 16 byte of a UUID field, even if > using BIGINT's

Re: UNIQUE KEY vs UNIQUE INDEX

2009-07-30 Thread b
On 07/30/2009 02:23 PM, Joerg Bruehe wrote: Hi ! mos wrote: At 09:13 AM 7/30/2009, b wrote: Are UNIQUE KEY& UNIQUE INDEX two ways of specifying the same thing? If not, what are the differences? Feel free to tell me to RTFM but please post manual chapters. I've been looking but haven't been a

Re: UNIQUE KEY vs UNIQUE INDEX

2009-07-30 Thread Joerg Bruehe
Hi ! mos wrote: > At 09:13 AM 7/30/2009, b wrote: >> Are UNIQUE KEY & UNIQUE INDEX two ways of specifying the same thing? >> If not, what are the differences? >> >> Feel free to tell me to RTFM but please post manual chapters. I've >> been looking but haven't been able to find anything. > > They

Re: UNIQUE KEY vs UNIQUE INDEX

2009-07-30 Thread mos
At 09:13 AM 7/30/2009, b wrote: Are UNIQUE KEY & UNIQUE INDEX two ways of specifying the same thing? If not, what are the differences? Feel free to tell me to RTFM but please post manual chapters. I've been looking but haven't been able to find anything. They are the same thing. If you mean

Re: Unique Id generation

2008-08-13 Thread R . Nils
> Why would the auto_increment not work for you? The only case where you > would have a problem is if the last record was deleted before mysql > shutdown. If you are really concerned about this unique scenario, > insert a dummy record before shutdown to guard against it and delete > the dummy reco

Re: RE: Unique Id generation

2008-08-13 Thread R . Nils
> >I try to generate a unique id for each row in a Mysql-InnoDB Table. > >Because of many deletes I can't use an auto_increment column. > >After a Mysql restart, the next value for an auto_increment-column is > >max(auto_increment-column)+1, and I need a really unique id. > > > [JS] See if the

RE: Unique Id generation

2008-08-12 Thread Fish Kungfu
rom: Jerry Schwartz <[EMAIL PROTECTED]> >Sent: Aug 12, 2008 9:46 AM >To: [EMAIL PROTECTED], mysql@lists.mysql.com >Subject: RE: Unique Id generation > >>I try to generate a unique id for each row in a Mysql-InnoDB Table. >>Because of many deletes I can't use an

Re: Unique Id generation

2008-08-12 Thread Brent Baisley
Why would the auto_increment not work for you? The only case where you would have a problem is if the last record was deleted before mysql shutdown. If you are really concerned about this unique scenario, insert a dummy record before shutdown to guard against it and delete the dummy record after yo

RE: Unique Id generation

2008-08-12 Thread Jerry Schwartz
>I try to generate a unique id for each row in a Mysql-InnoDB Table. >Because of many deletes I can't use an auto_increment column. >After a Mysql restart, the next value for an auto_increment-column is >max(auto_increment-column)+1, and I need a really unique id. > [JS] See if the UUID() functio

Re: Unique Rowid

2007-07-19 Thread Perrin Harkins
On 7/19/07, John Comerford <[EMAIL PROTECTED]> wrote: I am in the process of putting together a web application. I have decided to add a 'RowId' field to all my tables and assign it a unique number so that I use it to retrieve data. In concept this number might be passed back to the server as p

Re: Unique Rowid

2007-07-19 Thread Olaf Stein
There is a general concern if the user can manipulate variables so that they pose a threat to your app... On 7/19/07 12:56 AM, "John Comerford" <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I am in the process of putting together a web application. I have > decided to add a 'RowId' field to all m

RE: UNIQUE KEY vs NULLs

2006-12-11 Thread imre
> From: Dan Buettner [mailto:[EMAIL PROTECTED] > This is a feature - a NULL value is an undefined value, > therefore two NULL values are not the same. Can be a little > confusing but makes sense when you think about it. > > A UNIQUE index does ensure that non-NULL values are unique; > you co

Re: UNIQUE KEY vs NULLs

2006-12-11 Thread Martijn Tonies
> I have an InnoDB table similar to this: > > CREATE TABLE Target > (IMSI VARCHAR(15) ASCII, > IMEI VARCHAR(15) ASCII, > UNIQUE KEY (IMSI, IMEI)); > > After playing a bit with it, I managed to add duplicate records, if one of > the fields was a NULL: > > +-+-+ > |

Re: UNIQUE KEY vs NULLs

2006-12-11 Thread Dan Buettner
This is a feature - a NULL value is an undefined value, therefore two NULL values are not the same. Can be a little confusing but makes sense when you think about it. A UNIQUE index does ensure that non-NULL values are unique; you could specify that your column not accept NULL values. Dan On

RE: UNIQUE KEY vs NULLs

2006-12-11 Thread emierzwa
It is expected behavior, you can make the unique key a primary key instead. This should prevent this situation. Ed -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 11, 2006 7:42 AM To: mysql@lists.mysql.com Subject: UNIQUE KEY vs NULLs Hi, I

Re: UNIQUE constraint, proper use

2005-11-22 Thread Martijn Tonies
> I have this SQL statement: > > CREATE TABLE rooms ( > idSERIAL, > room_name TEXT UNIQUE, > location TEXT, > last_updated TIMESTAMP DEFAULT > CURRENT_TIMESTAMP NOT NULL

Re: UNIQUE constraint, proper use

2005-11-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ferindo Middleton Jr <[EMAIL PROTECTED]> writes: > I have this SQL statement: > CREATE TABLE rooms ( > idSERIAL, > room_name TEXT UNIQUE, > location TEXT, >

Re: UNIQUE constraint, proper use

2005-11-21 Thread Paul DuBois
At 22:49 -0500 11/21/05, Ferindo Middleton Jr wrote: I have this SQL statement: CREATE TABLE rooms ( idSERIAL, room_name TEXT UNIQUE, location TEXT, last_updated TIMESTAMP

Re: UNIQUE and INDEX using same field.

2005-10-28 Thread Michael J. Pawlowsky
[EMAIL PROTECTED] wrote: "Michael J. Pawlowsky" <[EMAIL PROTECTED]> wrote on 10/28/2005 11:28:42 AM: When creating an index in phpMySQL I get a warning message about having 2 indexes using the same field. The table is simply a product comment table. The first index is simply an INDEX on

Re: UNIQUE and INDEX using same field.

2005-10-28 Thread SGreen
"Michael J. Pawlowsky" <[EMAIL PROTECTED]> wrote on 10/28/2005 11:28:42 AM: > > When creating an index in phpMySQL I get a warning message about having > 2 indexes using the same field. > > The table is simply a product comment table. > > The first index is simply an INDEX on the product_id to

Re: UNIQUE issue at mysql 4.* and mysql 5.*

2005-08-02 Thread Gleb Paharenko
Hello. It works for me on MySQL 5.0.10: mysql> CREATE TABLE `manager_new` ( -> `id` bigint(20) NOT NULL auto_increment, -> `id_from_hits` bigint(20) default NULL, -> `from_ip` varchar(15) default NULL, -> `pool` char(1) NOT NULL default 'n', -> `to_ip` varcha

Re: unique by field issue

2005-07-01 Thread SGreen
Seth Leonard <[EMAIL PROTECTED]> wrote on 07/01/2005 04:43:05 PM: > > I constantly bump up against this issue and am looking for a good > solution. I want a query that will return multiple rows, but only one > row per unique identifier in one field. > > > > For instance, if I have the followi

Re: Unique Index on multiple columns that can contain NULL in MySQL

2005-05-05 Thread Martijn Tonies
> From: "Dennis Fogg" > > I'm getting lots of duplicate rows even though I have a > > unique index defined over multiple columns. > > The issue is that multiple NULL values are allowed, > > even when some values are not null. > > This could be as specified by the SQL standard, > > but it's certai

Re: Unique Index on multiple columns that can contain NULL in MySQL

2005-05-05 Thread Jigal van Hemert
From: "Dennis Fogg" > I'm getting lots of duplicate rows even though I have a > unique index defined over multiple columns. > The issue is that multiple NULL values are allowed, > even when some values are not null. > This could be as specified by the SQL standard, > but it's certainly confusing fo

Re: Unique Index on multiple columns that can contain NULL in MySQL

2005-05-04 Thread Hank
I think you should review the very recent thread "why NOT NULL in PRIMARY key??" which might shed some light on your particular issue. In a nutshell, NULL!=NULL, so the database engine can not detect the duplicate rows, as is expected. -Hank On 5/4/05, Dennis Fogg <[EMAIL PROTECTED]> wrote: > I'

Re: Unique items from all columns, very slow

2005-04-21 Thread Willie Gnarlson
On 4/21/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/21/2005 01:39:15 > PM: > > On 4/21/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 > > 05:46:25 PM: > > > > On 4/20/05, [EMAIL

Re: Unique items from all columns, very slow

2005-04-21 Thread SGreen
Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/21/2005 01:39:15 PM: > On 4/21/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 > 05:46:25 PM: > > > On 4/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Willie Gnarlson <[E

Re: Unique items from all columns, very slow

2005-04-21 Thread Willie Gnarlson
On 4/21/05, Willie Gnarlson <[EMAIL PROTECTED]> wrote: (...) > It actually seems slower. The separate tables from a previous try look > like this: > > CREATE TABLE `ET` ( > `ET` double NOT NULL default '0', > PRIMARY KEY (`ET`), > ) ENGINE=MyISAM DEFAULT CHARSET=latin1; > > That table has

Re: Unique items from all columns, very slow

2005-04-21 Thread Willie Gnarlson
On 4/21/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 05:46:25 PM: > > On 4/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 > 01:56:03 PM: > > > > On 4/20/05, Dan Nels

Re: Unique items from all columns, very slow

2005-04-21 Thread SGreen
Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 05:46:25 PM: > On 4/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 01:56:03 PM: > > > On 4/20/05, Dan Nelson <[EMAIL PROTECTED]> wrote: > > > > In the last episode (Apr 20),

Re: Unique items from all columns, very slow

2005-04-20 Thread Willie Gnarlson
On 4/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 01:56:03 PM: > > On 4/20/05, Dan Nelson <[EMAIL PROTECTED]> wrote: > > > In the last episode (Apr 20), Willie Gnarlson said: > > > > I have been attempting to uncover a fast method

Re: Unique items from all columns, very slow

2005-04-20 Thread SGreen
Willie Gnarlson <[EMAIL PROTECTED]> wrote on 04/20/2005 01:56:03 PM: > On 4/20/05, Dan Nelson <[EMAIL PROTECTED]> wrote: > > In the last episode (Apr 20), Willie Gnarlson said: > > > I have been attempting to uncover a fast method for retrieving unique > > > items from every column in a table. T

Re: Unique items from all columns, very slow

2005-04-20 Thread Willie Gnarlson
On 4/20/05, Dan Nelson <[EMAIL PROTECTED]> wrote: > In the last episode (Apr 20), Willie Gnarlson said: > > I have been attempting to uncover a fast method for retrieving unique > > items from every column in a table. The table has approximately 60 > > thousand rows. Each row has an index associate

Re: Unique items from all columns, very slow

2005-04-19 Thread Dan Nelson
In the last episode (Apr 20), Willie Gnarlson said: > I have been attempting to uncover a fast method for retrieving unique > items from every column in a table. The table has approximately 60 > thousand rows. Each row has an index associated with it, and running > 'explain select distinct class fr

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Gustafson, Tim" <[EMAIL PROTECTED]> writes: > Martijn, > The problem is that I don't want more than one row in the table that has > a null value in the column. As you've pointed out in your e-mail, > there's a difference between NULL and BLANK. It's not that I do

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Martijn Tonies
Tim, > The table in question is used to store aliases to web sites. That is, > "meitech.com" is the main web site, and "www.meitech.com" is the alias. > So, the first column is the domain name in question, and the second on > is the host name part of the alias, in this example "www". > > Now, I a

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Martijn Tonies
> The problem is that I don't want more than one row in the table that has > a null value in the column. As you've pointed out in your e-mail, > there's a difference between NULL and BLANK. It's not that I don't want > NULL values, it's that I don't want MORE THAN ONE. I can easily continue arg

RE: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Gustafson, Tim
Gustafson, Tim; Paul DuBois; mysql@lists.mysql.com Subject: Re: UNIQUE Key Allowing Duplicate NULL Values Tim, > Oh well, thanks anyhow. > > If I could put in a feature suggestion, it would be a flag that I could > set to disallow duplicate nulls. :) What for? NULL is not equal to N

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Martijn Tonies
Tim, > Oh well, thanks anyhow. > > If I could put in a feature suggestion, it would be a flag that I could > set to disallow duplicate nulls. :) What for? NULL is not equal to NULL. Period. If you don't want NULLs, make the column "not null". The specification is correct. With regards, Mart

RE: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Gustafson, Tim
/ -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2005 8:14 AM To: Gustafson, Tim; mysql@lists.mysql.com Subject: RE: UNIQUE Key Allowing Duplicate NULL Values At 8:10 -0500 2/23/05, Gustafson, Tim wrote: >Is there any flag I can set on

RE: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Paul DuBois
x27;d have to use a BDB table, because only BDB allows a single NULL per UNIQUE index. -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 22, 2005 3:13 PM To: Gustafson, Tim; mysql@lists.mysql.com Subject: Re: UNIQUE Key Allowing Duplicate NULL Values At

RE: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Gustafson, Tim
:[EMAIL PROTECTED] Sent: Tuesday, February 22, 2005 3:13 PM To: Gustafson, Tim; mysql@lists.mysql.com Subject: Re: UNIQUE Key Allowing Duplicate NULL Values At 15:00 -0500 2/22/05, Gustafson, Tim wrote: >Hi there! > >I have a table, defined as follows: > >CREATE TABLE `Web

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-22 Thread Paul DuBois
At 15:00 -0500 2/22/05, Gustafson, Tim wrote: Hi there! I have a table, defined as follows: CREATE TABLE `WebSiteDomainNames` ( `ID` int(10) unsigned NOT NULL auto_increment, `WebSite` int(10) unsigned NOT NULL default '0', `DomainName` int(10) unsigned NOT NULL default '0', `Alias` char(16

Re: Unique IDs

2005-01-07 Thread Joshua J. Kugler
When I saw this message a few weeks ago, I *knew* MySQL had something for this, but I couldn't remember where I saw it, and I couldn't find it. Today I found it. Take a look at: http://dev.mysql.com/doc/mysql/en/Miscellaneous_functions.html and scroll down to UUID() Returns a Universal Unique

Re: unique key <-> primary key

2004-12-29 Thread Martijn Tonies
Hello, > RE: > > And columns in primary keys must be NOT NULL. Columns in unique > > keys can be NULL (if they are NOT NULL, then the unique key is > > functionally the same as a primary key). > > OK, thanks guys for the explanation. > > Then the result of mysqldump table definition part: > > UNI

Re: unique key <-> primary key

2004-12-29 Thread Martijn Tonies
> >> I have two tables, seemigly very similar setup; the primary key is the > >> combination of two columns. With mysqldump, however, the table > >> definition of the two tables looks different. > >> > >> Mysqldump on table 1 says > >> ... > >> UNIQUE KEY HONstid (HONstid,HONname) >

Re: unique key <-> primary key

2004-12-28 Thread Gaspar Bakos
Hi, RE: > And columns in primary keys must be NOT NULL. Columns in unique > keys can be NULL (if they are NOT NULL, then the unique key is > functionally the same as a primary key). OK, thanks guys for the explanation. Then the result of mysqldump table definition part: UNIQUE KEY HONstid (HON

Re: unique key <-> primary key

2004-12-28 Thread Paul DuBois
At 22:27 +0100 12/28/04, Martijn Tonies wrote: Hello, I have two tables, seemigly very similar setup; the primary key is the combination of two columns. With mysqldump, however, the table definition of the two tables looks different. Mysqldump on table 1 says ... UNIQUE KEY HONstid (H

Re: unique key <-> primary key

2004-12-28 Thread Martijn Tonies
Hello, > I have two tables, seemigly very similar setup; the primary key is the > combination of two columns. With mysqldump, however, the table > definition of the two tables looks different. > > Mysqldump on table 1 says > ... > UNIQUE KEY HONstid (HONstid,HONname) > whereas on table 2 i

Re: Unique IDs

2004-12-22 Thread Philippe Poelvoorde
with implicit join : INSERT into table1(id, list of other columns) select m.newID, list of other columns from table2, tmpIDMAP where m.id = table2.id UPDATE table3, tmpIDMAP SET table3.parentID = m.newID where m.id = table3.parentID Andrew Mull wrote: Thank you. I'll have to review the SQL care

Re: Unique IDs

2004-12-21 Thread Andrew Mull
Thank you. I'll have to review the SQL carefully as I haven't used inner joins in quite some time :) Quoting [EMAIL PROTECTED]: > Create a temporary table that will act as a map between your old IDs and > your new ones. That way you can re-use those values and change them from > the old val

Re: Unique IDs

2004-12-21 Thread SGreen
Create a temporary table that will act as a map between your old IDs and your new ones. That way you can re-use those values and change them from the old values to the new values. LOCK TABLE table1 WRITE, table2 WRITE, table3 WRITE; select @max_id:=max(id) FROM table1; CREATE TEMPORARY TABLE

Re: Unique IDs

2004-12-21 Thread Andrew Mull
You are correct in that I need to merge two tables. However, I'm not clear on how to update the FKs in the sub tables. Example, the main table (Person) has a sub table (Address). Person has a 1:N relationship with Address. So Address has the Person's ID as a FK. How do I update the FK in

Re: Unique IDs

2004-12-21 Thread Philippe Poelvoorde
Andrew Mull wrote: I'm working on a rather large database with many cross-linked tables currently using auto increment IDs. The system is primarily a web based system, however, there will be times that the system will be run as a stand alone server...meaning no internet connection is available.

Re: Unique index on two fields

2004-11-18 Thread Andrew Kuebler
ALTER TABLE tablename ADD UNIQUE (Column1, Column2); Best Regards, Andrew > Can someone explain how I can make a combination of two fields be a > unique index. > > For example, in my table I have an OrderID field and a LineItems field. > Individually the fields are not unique but when combined t

Re: Unique Key question

2004-08-05 Thread Michael Stassen
BINARY is for CHAR and VARCHAR, but he's using TINYTEXT. The binary version of TINYTEXT is TINYBLOB. Michael mos wrote: Paul, Just use the "Binary" column attribute to make it case sensitive.. From MySQL Manual: http://dev.mysql.com/doc/mysql/en/CHAR.html As of MySQL 4.1, values in CHAR

Re: unique field problem

2004-04-09 Thread chillz
BT> Hello again, BT> I have a form that users fill out and submit into a mysql database using php. BT> The problem I have is that there is only one unique field in the main BT> table... it's an int that's auto-incremented with each new entry. This works BT> fine unless the user accidentally sub

Re: unique varchar in field

2004-04-07 Thread Paul DuBois
At 20:41 -0400 4/7/04, Brad Tilley wrote: Hello again, How do you make a field unique, but not have it as part of the primary key? For example, I have a 'computers' table that has a 'comp_id' field that's the primary key. It's an int that's auto-incremented with each new entry. The same table has

Re: unique varchar in field

2004-04-07 Thread Michael Stassen
Brad Tilley wrote: Hello again, How do you make a field unique, but not have it as part of the primary key? For example, I have a 'computers' table that has a 'comp_id' field that's the primary key. It's an int that's auto-incremented with each new entry. The same table has a 'comp_serial' fie

Re: Unique from this point forward

2004-03-29 Thread Martijn Tonies
Hi Scott, > Is there any way to define a column in MySql 4 that is to be unique from > this point forward. Meaning, there are indeed dupes in the column now, > those are ok, there is really no repairing that damage as the data was > inherited from somewhere else. I am constantly having to selec

RE: unique values across more than one column

2004-03-01 Thread Colin Williams
Hi, Could you just break out the email information into its own table? Then you could have columns like the following: UserID (foreign key), email (varchar), type (int: 1=primary email, 2=alias email). Then you can just have the email column defined as a unique index and relate the email to the

Re: unique values across more than one column

2004-02-27 Thread Michael Stassen
Anand Buddhdev wrote: On Fri, Feb 27, 2004 at 12:58:14PM +0200, Egor Egorov wrote: I'm using mysql version 3.23.58, on Fedora core 1 (the default supplied on the system). I have searched the mailing list archives, and google, for my query, but have not yet found an answer. Does anyone know if it

Re: unique values across more than one column

2004-02-27 Thread Anand Buddhdev
On Fri, Feb 27, 2004 at 01:54:13PM +0200, Egor Egorov wrote: > > Ok, thanks for the response. > > > > The problem with first doing a select, and then an insert, is that > > there exists a race condition. Between the select and insert, someone > > else could insert a row which might cause a duplic

Re: unique values across more than one column

2004-02-27 Thread Alec . Cawley
Anand Buddhdev <[EMAIL PROTECTED]> wrote on 27/02/2004 11:26:41: > The problem with first doing a select, and then an insert, is that > there exists a race condition. Between the select and insert, someone > else could insert a row which might cause a duplication. > > I have another soluti

Re: unique values across more than one column

2004-02-27 Thread Egor Egorov
Anand Buddhdev <[EMAIL PROTECTED]> wrote: > On Fri, Feb 27, 2004 at 12:58:14PM +0200, Egor Egorov wrote: > >> > I'm using mysql version 3.23.58, on Fedora core 1 (the default >> > supplied on the system). >> > >> > I have searched the mailing list archives, and google, for my query, >> > but have

Re: unique values across more than one column

2004-02-27 Thread Anand Buddhdev
On Fri, Feb 27, 2004 at 12:58:14PM +0200, Egor Egorov wrote: > > I'm using mysql version 3.23.58, on Fedora core 1 (the default > > supplied on the system). > > > > I have searched the mailing list archives, and google, for my query, > > but have not yet found an answer. > > > > Does anyone know

Re: unique values across more than one column

2004-02-27 Thread Egor Egorov
Anand Buddhdev <[EMAIL PROTECTED]> wrote: > > I'm using mysql version 3.23.58, on Fedora core 1 (the default > supplied on the system). > > I have searched the mailing list archives, and google, for my query, > but have not yet found an answer. > > Does anyone know if it's possible to define 2 c

Re: Unique IDs

2004-02-13 Thread Keith C. Ivey
On 12 Feb 2004 at 22:57, Bill Easton wrote: > You can use + 1 instead of + interval 1 second, but it may give > different results some day if MySQL changes the precision of > timestamp. Actually, that won't work in all cases. If the current timestamp is 20040213114859, then adding 1 (rather tha

RE: Unique IDs

2004-02-12 Thread Tom Horstmann
Hi Craig, > I have a very large web app that uses timestamp for unique IDs. > Everything was rolling fine until we started getting many users per > second, causing some of the unique IDs to not be unique -- users were > being assigned the same timestamp. Since the web app is so large we > don't wa

Re: Unique IDs

2004-02-12 Thread Bill Easton
terval 1 second, but it may give different results some day if MySQL changes the precision of timestamp. HTH Bill Easton > Subject: Re: Unique IDs > From: Craig Jackson <[EMAIL PROTECTED]> > To: "Keith C. Ivey" <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > D

Re: Unique IDs

2004-02-12 Thread Eric @ Zomething
ent the wheel. Eric > Original Message > From: Jeff Mathis <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Cc: "Keith C. Ivey" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Date: Thu, Feb-12-2004 11:13 AM > Subject: Re: Unique IDs > > as everyone has

Re: Unique IDs

2004-02-12 Thread Jeff Mathis
as everyone has pointed out, using timestamps as a unique id was a design flaw. you should fix the problem using an auto-increment field. that said, can you change the column type you are currently using as a timestamp to be an auto-increment int field? the return type in both cases is technica

Re: Unique IDs

2004-02-12 Thread Keith C. Ivey
On 12 Feb 2004 at 11:57, Craig Jackson wrote: > Thanks for the speedy reply and I have already recommended > auto_increment for the solution. We do need that quick fix until the > problem is fixed. How would I go about making Mysql wait one second > between inserts. We only get about 1000 hits per

RE: Unique IDs

2004-02-12 Thread nalaka_nanayakkara
, February 12, 2004 9:57 AM To: Keith C. Ivey Cc: [EMAIL PROTECTED] Subject:Re: Unique IDs On Thu, 2004-02-12 at 11:47, Keith C. Ivey wrote: > Craig Jackson <[EMAIL PROTECTED]> wrote: > > > I have a very large web app that uses timestamp for unique IDs. > >

Re: Unique IDs

2004-02-12 Thread Mike Miller
MySQL), sleep for a second, then try the insert again. I doubt there's a good way to hang up the database on the issue. Cheers; -M From: Craig Jackson <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: "Keith C. Ivey" <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subjec

Re: Unique IDs

2004-02-12 Thread Craig Jackson
On Thu, 2004-02-12 at 11:47, Keith C. Ivey wrote: > Craig Jackson <[EMAIL PROTECTED]> wrote: > > > I have a very large web app that uses timestamp for unique IDs. > > Everything was rolling fine until we started getting many users per > > second, causing some of the unique IDs to not be unique --

  1   2   >