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

2015-03-24 Thread Johan De Meersman
Hornung chris.horn...@klaviyo.com To: MySql mysql@lists.mysql.com 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 DB has a relatively small number of duplicative rows

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

2015-03-24 Thread Chris Hornung
a trailing space or similar 'invible' character that makes it not identical. - Original Message - From: Chris Hornungchris.horn...@klaviyo.com To: MySqlmysql@lists.mysql.com Sent: Monday, 23 March, 2015 18:20:36 Subject: duplicate rows in spite of multi-column unique constraint Hello, I'm

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

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 create table

Re: how to create unique key for long varchar?

2013-11-05 Thread Dan Nelson
= 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 different urls will have the same md5(even it's probablitiy

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: I want to create a table with a long

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 dnel...@allantgroup.com wrote

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 dnel...@allantgroup.com wrote

Re: how to create unique key for long varchar?

2013-11-05 Thread Li Li
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 dnel...@allantgroup.com wrote: In the last episode (Nov 05), Li Li said: I want to create a table with a long varchar column

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 url is unique

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 index - opinions sought

2012-07-16 Thread Rick James
.) 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 I have a MySQL table (call

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

RE: Unique index - opinions sought

2012-07-16 Thread Rick James
...@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 billion, we need to discuss in more detail. Let's assume 1M... Around 1M

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 can create

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

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 dae...@daevid.com wrote: I can think of several ways to accomplish

Next Unique Number - Generation

2011-07-21 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 defined

Re: Next Unique Number - Generation

2011-07-21 Thread Vikram A
mysql@lists.mysql.com Sent: Thursday, 21 July 2011 12:06 PM Subject: Re: 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

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_INCREMENT

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, something similar was my first thought, too

Re: best way to have a unique key

2011-01-21 Thread Michael Dykman
, 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'm not entirely confident about that myself, either, though: as Pratchett put it, one-in-a-million chances tend to pop up nine times

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 mac address of the server.. While

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 entirely true - and even

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 server

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 anthony.p...@utoronto.cawrote: 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

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

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
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 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 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 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 unique key uuid

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'm

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 neil.tompk...@googlemail.com Date: Wed, Oct 13, 2010 at 8:22 PM Subject: Re: Primary key not unique on InnoDB table To: Travis Ard travis_...@hotmail.com Cc

RE: Primary key not unique on InnoDB table

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

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_ci NOT NULL

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
neil.tompk...@googlemail.com 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_id` bigint(20) NOT NULL

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
=-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` bigint(20) NOT NULL AUTO_INCREMENT, `default_teams_id` bigint(20) NOT NULL, `first_name` varchar(100

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 neil.tompk...@googlemail.com wrote: I've the following table. But why isn't the primary key unique, e.g. preventing

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
single primary key. Am I wrong? -- João Cândido de Souza Neto Tompkins Neil neil.tompk...@googlemail.com 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

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
field it must be your single primary key. Am I wrong? -- João Cândido de Souza Neto Tompkins Neil neil.tompk...@googlemail.com escreveu na mensagem news:aanlkti=-1wvuxdfsq4km6rfz0wsrlpphug1bnt4x9...@mail.gmail.com... I've the following table. But why isn't the primary key unique, e.g

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
neil.tompk...@googlemail.com 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_id` bigint(20

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 (players_id,default_teams_id). _Krishna

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, `first_name

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

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 Travis Ard
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 primary key unique, e.g

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 isn't the primary key unique, e.g. preventing

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

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 n...@dinagon.com 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

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
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 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 vegiv...@tuxera.bewrote: Hmm, that's a very

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

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
be the optimal solution here. On Mon, Sep 13, 2010 at 2:05 PM, Fish Kungfu fish.kun...@gmail.com 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 gotchas. Just

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 what

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 across multiple databases Hmm

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 databases Well, not exactly. I do

Re: Unique ID's across multiple databases

2010-09-13 Thread Johnny Withers
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, some of them are at my data warehouse. So, neither NAS or Fibre Channel is a solution

Re: Unique ID's across multiple databases

2010-09-13 Thread Kiss Dániel
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 of them are placed at customers, some of them are at my data warehouse. So, neither NAS

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, I'll

RE: Unique ID's across multiple databases

2010-09-13 Thread Daevid Vincent
://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 with other databases periodically. So that a user in one

RE: Unique ID's across multiple databases

2010-09-13 Thread Wm Mussatto
. 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 better (Postgress, Oracle, SQL Server, etc?) I too have a need for a unique identifier that will mesh

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 joh...@pixelated.netwrote: 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

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, also about setting the *auto

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

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

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,uɹnʇ pןɹoʍ ǝɥʇ

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

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

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 1 and 99) then you could create

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

2010-05-28 Thread Andre Matos
[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 1 and 99) then you could create a 99-row table with one integer

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 be between 1 and 99) then you

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, although I was trying to get

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 andrema

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 andrema...@mineirinho.org 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.

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

2010-05-28 Thread Kevin (Gmail)
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. - Original Message

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 mo...@fastmail.fm 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-25 Thread Ananda Kumar
...@fastmail.fm 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 loading the data, load the data, then do

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: 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 be any

SQL query for unique values.

2010-02-15 Thread Ravishankar BV .
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: MP, KA Orange: AP,MH

Re: SQL query for unique values.

2010-02-15 Thread Manasi Save
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

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

2009-12-11 Thread Matthew Blissett
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`), KEY

Which unique key is hit with my insert?

2009-11-27 Thread Jan Fabry
- 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 is the best answer. If anything new comes up here, I will also put in on the Stack

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: Distinct max() and separate unique value

2009-10-20 Thread DaWiz
Message - From: Eric Anderson e...@macandbumble.com To: mysql@lists.mysql.com 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

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

Re: Distinct max() and separate unique value

2009-10-20 Thread DaWiz
- Original Message - From: Eric Anderson ke...@on-e.com To: mysql@lists.mysql.com 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

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 archives: http

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

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 are the same

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

Re: How to generate unique primary key in MySQL?

2009-04-28 Thread Jim Lyons
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-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 really guarantee uniqueness, If you mean

How to generate unique primary key in MySQL?

2009-04-27 Thread yuan edit
unique primary key in MySQL? Thank you

Re: How to generate unique primary key in MySQL?

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

Re: How to generate unique primary key in MySQL?

2009-04-27 Thread Michael Dykman
. 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 edit.y...@gmail.com wrote: I have a shopping cart table like this: CREATE TABLE

  1   2   3   4   5   6   7   >