Re: duplicate rows in spite of multi-column unique constraint

2015-03-24 Thread shawn l.green
Hi Chris, On 3/24/2015 10:07 AM, Chris Hornung wrote: Thanks for the suggestions regarding non-printing characters, definitely makes sense as a likely culprit! However, the data really does seem to be identical in this case: mysql> select id, customer_id, concat('-', group_id, '-') from app_cu

Re: duplicate rows in spite of multi-column unique constraint

2015-03-24 Thread Chris Hornung
p_customergroupmembership where customer_id ='ajEiQA'; I suspect one of those group IDs has a trailing space or similar 'invible' character that makes it not identical. - Original Message - From: "Chris Hornung" To: "MySql" Sent: Monday, 23 M

Re: duplicate rows in spite of multi-column unique constraint

2015-03-24 Thread Johan De Meersman
-- Original Message - > From: "Chris Hornung" > To: "MySql" > Sent: Monday, 23 March, 2015 18:20:36 > Subject: duplicate rows in spite of multi-column unique constraint > Hello, > > I'm come across a situation where a table in our production D

duplicate rows in spite of multi-column unique constraint

2015-03-23 Thread Chris Hornung
Hello, I'm come across a situation where a table in our production DB has a relatively small number of duplicative rows that seemingly defy the unique constraint present on that table. We're running MySQL 5.6.19a via Amazon RDS. The table in question is ~250M rows. `show cr

Re: how to create unique key for long varchar?

2013-11-05 Thread Li Li
king. > but the problem is that if I define md5 as unique key and there exists > 2 different urls with the same md5. I can't insert the second url > anymore > > On Tue, Nov 5, 2013 at 11:55 PM, Dan Nelson wrote: >> In the last episode (Nov 05), Li Li said: >>&g

Re: how to create unique key for long varchar?

2013-11-05 Thread Michael Dykman
I prefer your solution in that it's something like Optimistic Locking. > but the problem is that if I define md5 as unique key and there exists > 2 different urls with the same md5. I can't insert the second url > anymore > > On Tue, Nov 5, 2013 at 11:55 PM, Dan Nelson &g

Re: how to create unique key for long varchar?

2013-11-05 Thread Li Li
I prefer your solution in that it's something like Optimistic Locking. but the problem is that if I define md5 as unique key and there exists 2 different urls with the same md5. I can't insert the second url anymore On Tue, Nov 5, 2013 at 11:55 PM, Dan Nelson wrote: > In the last ep

RE: how to create unique key for long varchar?

2013-11-05 Thread Rick James
. > -Original Message- > From: Dan Nelson [mailto:dnel...@allantgroup.com] > Sent: Tuesday, November 05, 2013 7:56 AM > To: Li Li > Cc: mysql@lists.mysql.com > Subject: Re: how to create unique key for long varchar? > > In the last episode (Nov 05), Li Li said: > >

Re: how to create unique key for long varchar?

2013-11-05 Thread Dan Nelson
aaa&fl=.... > I want the url is unique when inserting it. > I googled and found > http://stackoverflow.com/questions/6800866/how-to-store-urls-in-mysql > this post suggests use md5 of url. But in theory, there will be > conflict that two differ

how to create unique key for long varchar?

2013-11-04 Thread Li Li
hi all I want to create a table with a long varchar column, maybe it's the url. according to dns spec, the url's max length is fixed. but I have to deal with url having long params such as a.html?q=&fl= I want the

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
ables.) Let's see the SELECTs that will be hitting the tables. Then we can discuss in more detail. > -Original Message- > From: Mark Goodge [mailto:m...@good-stuff.co.uk] > Sent: Monday, July 16, 2012 8:09 AM > To: mysql > Subject: Unique index - opinions sought

Unique index - opinions sought

2012-07-16 Thread Mark Goodge
I have a MySQL table (call it, say, item_spine) which contains three fields which, together, form a unique key. These three fields are a guid, a start date and an end date. The guid is alphanumeric (a fixed-length six characters) and the dates are ISO format dates (-MM-DD). I also have

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

Unique on non null entries but allowing multiple nulls

2011-10-17 Thread Peng Yu
Hi, 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 a construct in mysql that

Re: Next Unique Number - Generation

2011-07-22 Thread Prabhat Kumar
Assign each server a number and prefix/append that number to the unique > ID. > I will suggest you above, append -A for first machine and -B for second machine. -Prabhat On Thu, Jul 21, 2011 at 12:13 PM, Daevid Vincent wrote: > I can think of several ways to accomplish this (or cl

RE: Next Unique Number - Generation

2011-07-21 Thread Daevid Vincent
I can think of several ways to accomplish this (or close to it). * Assign each server a number and prefix/append that number to the unique ID. * initialize each table on each server at a different huge number so they don't ever collide: ALTER TABLE `students` AUTO_INCR

Re: Next Unique Number - Generation

2011-07-20 Thread Vikram A
: Next Unique Number - Generation Hi in ur database define the 2 numbers as auto increment. Neil Martins Exactus Corporation Pvt. Limited ISO 9001:2000 certified 1st floor, Raheja Plaza, LBS Marg, Ghatkopar (West), Mumbai 400 086 India T: (9122) 66505900 F: (9122) 22040826 Url:www.exactuscorp.com

Next Unique Number - Generation

2011-07-20 Thread Vikram A
Hi there, I need a technical help fro you,  I have developed a software for college & school. Here we have concept called register number/admission number. These are two unique umber for each student. My application resides Client/server model.  These numbers will be generated (some def

Re: best way to have a unique key

2011-01-21 Thread Michael Satterwhite
On Friday, January 21, 2011 09:23:47 am Jerry Schwartz wrote: > > [JS] A UUID (what Microsoft calls a GUID) is based in part on the MAC > address of the generating device. Since MAC addresses are supposed to be > unique across the known universe, so should a UUID. > Not enti

RE: best way to have a unique key

2011-01-21 Thread Jerry Schwartz
>-Original Message- >From: Michael Dykman [mailto:mdyk...@gmail.com] >Sent: Friday, January 21, 2011 11:35 AM >To: Johan De Meersman >Cc: Anthony Pace; mysql. >Subject: Re: best way to have a unique key > >One of the components of the UUID is drawn form the ma

Re: best way to have a unique key

2011-01-21 Thread Michael Dykman
uld be a > Universal Unique IDentifier. It's afaik a random 128-bit number; given the > space to choose from it should be rather unique. I have to admit that I'm > not entirely confident about that myself, either, though: as Pratchett put > it, one-in-a-million chances tend to

RE: best way to have a unique key

2011-01-21 Thread Jerry Schwartz
>-Original Message- >From: vegiv...@gmail.com [mailto:vegiv...@gmail.com] On Behalf Of Johan De >Meersman >Sent: Friday, January 21, 2011 1:22 AM >To: Anthony Pace >Cc: Michael Dykman; mysql. >Subject: Re: best way to have a unique key > >I have to say, som

Re: best way to have a unique key

2011-01-20 Thread Johan De Meersman
I have to say, something similar was my first thought, too - you never mention uuid in your original post. As already stated, uuid() should be a Universal Unique IDentifier. It's afaik a random 128-bit number; given the space to choose from it should be rather unique. I have to admit that I&

RE: best way to have a unique key

2011-01-20 Thread Daevid Vincent
http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/ > -Original Message- > From: Krishna Chandra Prajapati [mailto:prajapat...@gmail.com] > Sent: Thursday, January 20, 2011 10:45 AM > To: Anthony Pace > Cc: mysql. > Subject: Re: best way to have a un

Re: best way to have a unique key

2011-01-20 Thread Michael Dykman
I should have read more carefully.. I apologize for my snap response. At a guess: as I recall, under M$ SQLServer the typical (only?) form of unique identifier used is something very UUID-like. MY information might be dated. I was certified as a SQL Server administrator perhaps 12 years agoI

Re: best way to have a unique key

2011-01-20 Thread Luciano Furtado
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What conflicts are you expecting? according to the documentation: A UUID is designed as a number that is globally unique in space and time. Two calls to UUID() are expected to generate two different values, even if these calls are performed on two

Re: best way to have a unique key

2011-01-20 Thread Anthony Pace
Although I did berate you for your obvious cheek, I will of course complement the acuteness of your response. On 1/20/2011 2:10 PM, Anthony Pace wrote: Dude, come on. I know that all primary keys have to be unique; however, I was obviously referring to the use of uuid over auto

Re: best way to have a unique key

2011-01-20 Thread Anthony Pace
I know of uuid() my problem is that there can be conflicts when copying the DB to a different machine, or working with sections of the db on different machines for load balancing. On 1/20/2011 1:44 PM, Krishna Chandra Prajapati wrote: > Please keep in mind this variable will also be displayed

Re: best way to have a unique key

2011-01-20 Thread Anthony Pace
Dude, come on. I know that all primary keys have to be unique; however, I was obviously referring to the use of uuid over auto incrementation. On 1/20/2011 1:36 PM, Michael Dykman wrote: It is axiomatic in the relational model that a primary must be unique. This is not a quirk put forth by

Re: best way to have a unique key

2011-01-20 Thread Krishna Chandra Prajapati
uuid() Krishna On Fri, Jan 21, 2011 at 12:02 AM, Anthony Pace wrote: > Due to certain reasons, the company I am doing business with has decided > that the primary key, for an orders table, be a unique key; however, I don't > like the possibility of it conflicting if moved to a

best way to have a unique key

2011-01-20 Thread Anthony Pace
Due to certain reasons, the company I am doing business with has decided that the primary key, for an orders table, be a unique key; however, I don't like the possibility of it conflicting if moved to another machine. What are some pitfalls of using a unique key, that is generated by a s

RE: Primary key not unique on InnoDB table

2010-10-15 Thread Travis Ard
ct: Fwd: Primary key not unique on InnoDB table Based on my reply below, do you recommend I continue to have these indexes ? -- Forwarded message -- From: Tompkins Neil Date: Wed, Oct 13, 2010 at 8:22 PM Subject: Re: Primary key not unique on InnoDB table To: Travis Ard Cc: &q

Fwd: Primary key not unique on InnoDB table

2010-10-15 Thread Tompkins Neil
Based on my reply below, do you recommend I continue to have these indexes ? -- Forwarded message -- From: Tompkins Neil Date: Wed, Oct 13, 2010 at 8:22 PM Subject: Re: Primary key not unique on InnoDB table To: Travis Ard Cc: "[MySQL]" Hi Travis, Thanks for you

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
requirements. > > -Travis > > -Original Message- > From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] > Sent: Wednesday, October 13, 2010 8:37 AM > To: [MySQL] > Subject: Primary key not unique on InnoDB table > > I've the following table. But why i

RE: Primary key not unique on InnoDB table

2010-10-13 Thread Travis Ard
and add to your storage requirements. -Travis -Original Message- From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Wednesday, October 13, 2010 8:37 AM To: [MySQL] Subject: Primary key not unique on InnoDB table I've the following table. But why isn't the pri

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
Shawn it is fine. I thought my primary key was just 1 field. On Wed, Oct 13, 2010 at 4:44 PM, Shawn Green (MySQL) < shawn.l.gr...@oracle.com> wrote: > On 10/13/2010 11:37 AM, Tompkins Neil wrote: > >> Shawn, sorry my error, I didn't realise I had two fields as the primary >> key >> >> > That's

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Shawn Green (MySQL)
On 10/13/2010 11:37 AM, Tompkins Neil wrote: Shawn, sorry my error, I didn't realise I had two fields as the primary key That's misinformation. You can have multiple fields as a primary key. Show us what you think is duplicate data and I may be able to help you fix your definition -- Shaw

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Shawn Green (MySQL)
On 10/13/2010 10:37 AM, Tompkins Neil wrote: I've the following table. But why isn't the primary key unique, e.g. preventing duplicates if entered ? CREATE TABLE `players_master` ( `players_id` bigint(20) NOT NULL AUTO_INCREMENT, `default_teams_id` bigint(20) NOT NULL, `

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
Of course, sorry totally stupid should I recognised that. Thanks Neil On Wed, Oct 13, 2010 at 3:46 PM, Krishna Chandra Prajapati < prajapat...@gmail.com> wrote: > Hi Neil, > > Yes, primary key is always unique. > > In your case, you are using composite key (player

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
have an auto_increment field it must be your > > > single primary key. Am I wrong? > > > > > > -- > > > João Cândido de Souza Neto > > > > > > "Tompkins Neil" escreveu na mensagem > > > news:aanlkti=-1wvuxdfsq4km6rfz0wsr

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
r as I know, if you have an auto_increment field it must be your > > single primary key. Am I wrong? > > > > -- > > João Cândido de Souza Neto > > > > "Tompkins Neil" escreveu na mensagem > > news:aanlkti=-1wvuxdfsq4km6rfz0wsrlpphug1b

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
w, if you have an auto_increment field it must be your > > single primary key. Am I wrong? > > > > -- > > João Cândido de Souza Neto > > > > "Tompkins Neil" escreveu na mensagem > > news:aanlkti=-1wvuxdfsq4km6rfz0wsrlpphug1bnt4x9...@m

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Krishna Chandra Prajapati
Hi Neil, Yes, primary key is always unique. In your case, you are using composite key (players_id,default_teams_id). _Krishna On Wed, Oct 13, 2010 at 8:07 PM, Tompkins Neil wrote: > I've the following table. But why isn't the primary key unique, e.g. > preventing dupli

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
veu na mensagem > news:aanlkti=-1wvuxdfsq4km6rfz0wsrlpphug1bnt4x9...@mail.gmail.com... >> I've the following table. But why isn't the primary key unique, e.g. >> preventing duplicates if entered ? >> >> CREATE TABLE `players_master` ( >> >> `players_id` bi

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
Neil" escreveu na mensagem news:aanlkti=-1wvuxdfsq4km6rfz0wsrlpphug1bnt4x9...@mail.gmail.com... > I've the following table. But why isn't the primary key unique, e.g. > preventing duplicates if entered ? > > CREATE TABLE `players_master` ( > > `players_

Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
I've the following table. But why isn't the primary key unique, e.g. preventing duplicates if entered ? CREATE TABLE `players_master` ( `players_id` bigint(20) NOT NULL AUTO_INCREMENT, `default_teams_id` bigint(20) NOT NULL, `first_name` varchar(100) COLLATE utf8_unicode_c

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
ession) 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/ > > Is this UUID issue unique to mySQL or are there other RDBMS's that handle > it be

RE: Unique ID's across multiple databases

2010-09-13 Thread Daevid Vincent
is a good summary about the issues: > http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/ Is this UUID issue unique to mySQL or are there other RDBMS's that handle it better (Postgress, Oracle, SQL Server, etc?) I too have a need for a unique identifier that will "mesh&quo

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-maste

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
ust be the optimal solution here. On Mon, Sep 13, 2010 at 2:05 PM, Fish Kungfu wrote: > 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 gotcha

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)

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

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 interes

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

Unique ID's across multiple databases

2010-09-12 Thread Kiss Dániel
Hi, I'm designing a master-to-master replication architecture. I wonder what the best way is to make sure both databases generate unique row ID's, so there won't be ID conflicts when replicating both directions. I read on forums about pro's and con's using UUID's

unique URL's as ID in mysql table

2010-06-04 Thread Norman Khine
hello, i have a mysql database that stores URL's in a table now i would like to change the schema so that the URL's are unique so my question is: is it appropriate to use URL's as a unique IDs if not what are the alternatives? any advise much appreciated norman -- ˙uʍop ǝpısdn p

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Kevin (Gmail)
h time (in fact it might speed up as the used rows are progressively deleted). It has the advantage that the random function is called only once: whereas using a single table requires looping until a unique random value is found, and as the table fills this will get really slow. - O

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Perrin Harkins
On Fri, May 28, 2010 at 11:38 AM, Andre Matos wrote: > I have a table that uses auto_increment to generate the Id automatically > working fine. > However, I need to create a new table where the Id must be a number generated > randomly, so I cannot use the auto_increment. You'd be better off usin

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Andre Matos
When I mentioned having everything in the Query, I was thinking about this. I don't want to have a loop repeating the query until I get a unique Id. This is ridicules and imagine how many queries I might end up running. No way! Thanks for the warning and feedback! Andre -- Andre Matos an

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jerry Schwartz
>-Original Message- >From: Andre Matos [mailto:andrema...@mineirinho.org] >Sent: Friday, May 28, 2010 1:44 PM >To: Steven Staples >Cc: mysql@lists.mysql.com >Subject: Re: Using RAND to get a unique ID that has not been used yet > >It seems to be a good approach,

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jerry Schwartz
>-Original Message- >From: Jim Lyons [mailto:jlyons4...@gmail.com] >Sent: Friday, May 28, 2010 11:49 AM >To: Andre Matos >Cc: mysql@lists.mysql.com >Subject: Re: Using RAND to get a unique ID that has not been used yet > >If your specs are that specific (IDs must

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Andre Matos
; > > >> -Original Message- >> From: Jim Lyons [mailto:jlyons4...@gmail.com] >> Sent: May 28, 2010 11:49 AM >> To: Andre Matos >> Cc: mysql@lists.mysql.com >> Subject: Re: Using RAND to get a unique ID that has not been used yet >> >> If you

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Steven Staples
> -Original Message- > From: Jim Lyons [mailto:jlyons4...@gmail.com] > Sent: May 28, 2010 11:49 AM > To: Andre Matos > Cc: mysql@lists.mysql.com > Subject: Re: Using RAND to get a unique ID that has not been used yet > > If your specs are that specific (IDs must be between

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jim Lyons
If your specs are that specific (IDs must be between 1 and 99) then you could create a 99-row table with one integer column and prefill it with the numbers 1 to 99 in random order. Then you could write a function that would select and return the first number in the table, then delete t

Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Andre Matos
Hi All, I have a table that uses auto_increment to generate the Id automatically working fine. However, I need to create a new table where the Id must be a number generated randomly, so I cannot use the auto_increment. MySQL has a function RAND. So I could use something like this: SELECT FLOO

Re: Any faster building primary/unique indexes after Load Data Infile?

2010-02-25 Thread Ananda Kumar
> > I am loading 35 million rows of data into an empty MyISAM table. This > table > > has 1 primary key (AutoInc) and 1 unique index and 2 non-unique indexes. > > > > Is it going to be any faster if I remove the indexes from the table > before > > loading th

Re: Any faster building primary/unique indexes after Load Data Infile?

2010-02-25 Thread Baron Schwartz
Hi, On Sun, Feb 21, 2010 at 1:42 PM, mos wrote: > I am loading 35 million rows of data into an empty MyISAM table. This table > has 1 primary key (AutoInc) and 1 unique index and 2 non-unique indexes. > > Is it going to be any faster if I remove the indexes from the table before &

Re: Any faster building primary/unique indexes after Load Data Infile?

2010-02-21 Thread Carsten Pedersen
other sources). Don't forget to set the MyISAM sort buffer size high while you create the indexes. / Carsten mos skrev: I am loading 35 million rows of data into an empty MyISAM table. This table has 1 primary key (AutoInc) and 1 unique index and 2 non-unique indexes. Is it going to b

Any faster building primary/unique indexes after Load Data Infile?

2010-02-21 Thread mos
I am loading 35 million rows of data into an empty MyISAM table. This table has 1 primary key (AutoInc) and 1 unique index and 2 non-unique indexes. Is it going to be any faster if I remove the indexes from the table before loading the data, load the data, then do an Alter Table .. add index

Re: SQL query for unique values.

2010-02-15 Thread Manasi Save
A 9 Banana TN 10 Apple MH 11 Jackfruit AP 12 Orange MH 13 Mango KA 14 Apple TN 15 Banana MP 16 Banana MH 17 Mango KA 18 Orange MP 19 Jackfruit AP 20 Apple TN From the above table, I want a SQL query which will list me the unique fruits and the states in which t

SQL query for unique values.

2010-02-15 Thread Ravishankar BV .
15 Banana MP 16 Banana MH 17 Mango KA 18 Orange MP 19 Jackfruit AP 20 Apple TN >From the above table, I want a SQL query which will list me the unique fruits >and the states in which they are grown, like: Apple: KA, MH, TN Banana: TN, AP, MP, MH Jackfruit: MH,MP,AP Mango:

Join between columns with unique keys randomly uses the keys, or uses a temporary table (which fails).

2009-12-11 Thread Matthew Blissett
HOW CREATE TABLE darwincoredata; CREATE TABLE `darwincoredata` ( `ID` int(10) NOT NULL auto_increment, `CatalogNumber` varchar(20) NOT NULL, [...more...], PRIMARY KEY (`ID`), UNIQUE KEY `CatalogNumber` (`CatalogNumber`), UNIQUE KEY `GlobalUniqueIdentifier` (`GlobalUniqueIdentifier`),

Which unique key is hit with my insert?

2009-11-27 Thread Jan Fabry
RIMARY" AND Seq_in_index = '2'; But this is an extra query - is there a way to know it from the first query? I also posted this question on Stack Overflow [ http://stackoverflow.com/questions/1486068/which-unique-key-is-hit-with-my-insert ], but I want to check whether this

Re: Distinct max() and separate unique value

2009-10-20 Thread DaWiz
- Original Message - From: "Eric Anderson" To: Sent: Tuesday, October 20, 2009 4:05 PM Subject: Re: Distinct max() and separate unique value I'm trying to formulate a query on a Wordpress database that will give me the highest 'object_id' with the

Re: Distinct max() and separate unique value

2009-10-20 Thread Eric Anderson
On Tue, 20 Oct 2009, DaWiz wrote: I would try: select max(object_id), term_taxonomy_id group by term_taxonomy_id order by term_taxonomy_id; max(column) returns a single value so distinct is not needed. The group by and order by should only have columns thaqt are displayed and that are not agg

Re: Distinct max() and separate unique value

2009-10-20 Thread DaWiz
Message - From: "Eric Anderson" To: Sent: Tuesday, October 20, 2009 3:42 PM Subject: Distinct max() and separate unique value I'm trying to formulate a query on a Wordpress database that will give me the highest 'object_id' with the highest 'term

Distinct max() and separate unique value

2009-10-20 Thread Eric Anderson
I'm trying to formulate a query on a Wordpress database that will give me the highest 'object_id' with the highest 'term_taxonomy_id', something like: +-+--+ | max(distinct object_id) | term_taxonomy_id | +-+--+ |

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 hav

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 hav

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

UNIQUE KEY vs UNIQUE INDEX

2009-07-30 Thread b
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. -- MySQL General Mailing List For list

Re: How to generate unique primary key in MySQL?

2009-04-28 Thread Michael Dykman
>> I wish my id has the same length,auto_increment can do this? >> > > I have a idear to generate unique primary key: > > select concat(cast(unix_timestamp() as char) , cast(substr(rand(),3,4) as > char(4))); > > Is this ok? any good idear? Your routine does not

Re: How to generate unique primary key in MySQL?

2009-04-28 Thread Jim Lyons
t; ... > user_id INT NOT NULL, > current_timestamp TIMESTAMP, > primary key (id) > ); > > I will not use auto_increment > > Is there other way to generate unique primary key in MySQL? > > Thank you > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com

Re: How to generate unique primary key in MySQL?

2009-04-27 Thread Michael Dykman
ed ie. SELECT uuid(); and produces a guaranteed unique 36 character sitrng, but this might not be very efficient in joins as your dataset grows. - michael dykman On Tue, Apr 28, 2009 at 12:59 AM, yuan edit wrote: > I have a shopping cart table like this: > > CREATE TABLE shopping_cart

Re: How to generate unique primary key in MySQL?

2009-04-27 Thread yuan edit
BTW,i am using MySQL 5.0

  1   2   3   4   5   6   7   >