Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Andrew Moore
Ah-ha, excuse my earlier response, I was under the impression you were trying to track schema changes etc. A On Fri, May 31, 2013 at 7:54 PM, Rick James wrote: > UUID PRIMARY KEY (or even secondary index) -- > Once the table gets big enough (bigger than RAM cache), each row INSERTed

RE: Audit Table storage for Primary Key(s)

2013-05-31 Thread Jason Trebilcock
Original Message- From: Neil Tompkins [mailto:neil.tompk...@googlemail.com] Sent: Friday, May 31, 2013 3:43 AM To: [MySQL] Subject: Fwd: Audit Table storage for Primary Key(s) Any advice anyone ? -- Forwarded message -- From: Neil Tompkins Date: Thu, May 30, 2013 at 8:27 AM

RE: Audit Table storage for Primary Key(s)

2013-05-31 Thread Rick James
UUID PRIMARY KEY (or even secondary index) -- Once the table gets big enough (bigger than RAM cache), each row INSERTed (or SELECTed) will be a disk hit. (Rule of Thumb: only 100 hits/sec.) This is because _random_ keys (like UUID) make caching useless. Actually, the slowdown will be

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Andrew Moore
sten > > > On 31-05-2013 12:58, Neil Tompkins wrote: > >> The kind of look ups will be trying to diagnose when and by who applied >> a update. So the primary key of the audit is important. My question is >> for performance, should the primary key be stored as a indexed fiel

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Carsten Pedersen
, Neil Tompkins wrote: The kind of look ups will be trying to diagnose when and by who applied a update. So the primary key of the audit is important. My question is for performance, should the primary key be stored as a indexed field like I mentioned before, or should I have a actual individual field

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Neil Tompkins
The kind of look ups will be trying to diagnose when and by who applied a update. So the primary key of the audit is important. My question is for performance, should the primary key be stored as a indexed field like I mentioned before, or should I have a actual individual field per primary key

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Carsten Pedersen
e applying. On Fri, May 31, 2013 at 9:58 AM, Carsten Pedersen wrote: On 30-05-2013 09:27, Neil Tompkins wrote: Hi, I've created a Audit table which tracks any changed fields for multiple tables. In my Audit table I'm using a UUID for the primary key. However I need to have a referen

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Neil Tompkins
created a Audit table which tracks any changed fields for multiple >> tables. In my Audit table I'm using a UUID for the primary key. However >> I >> need to have a reference back to the primary key(s) of the table audited. >> >> At the moment I've a VARCH

Re: Audit Table storage for Primary Key(s)

2013-05-31 Thread Carsten Pedersen
On 30-05-2013 09:27, Neil Tompkins wrote: Hi, I've created a Audit table which tracks any changed fields for multiple tables. In my Audit table I'm using a UUID for the primary key. However I need to have a reference back to the primary key(s) of the table audited. At the mom

Fwd: Audit Table storage for Primary Key(s)

2013-05-31 Thread Neil Tompkins
Any advice anyone ? -- Forwarded message -- From: Neil Tompkins Date: Thu, May 30, 2013 at 8:27 AM Subject: Audit Table storage for Primary Key(s) To: "[MySQL]" Hi, I've created a Audit table which tracks any changed fields for multiple tables. In my Audit ta

Audit Table storage for Primary Key(s)

2013-05-30 Thread Neil Tompkins
Hi, I've created a Audit table which tracks any changed fields for multiple tables. In my Audit table I'm using a UUID for the primary key. However I need to have a reference back to the primary key(s) of the table audited. At the moment I've a VARCHAR field which stores primary

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-16 Thread Hank
removed and mysql restarted so "db.log" is no longer ignored in >> >> replication, >> >> this bug goes away and correct results are reported on the slave. >> >> >> >> -Hank Eskin >> >> >> >> >> >> On Wed, J

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Claudio Nanni
s no longer ignored in > >> replication, > >> this bug goes away and correct results are reported on the slave. > >> > >> -Hank Eskin > >> > >> > >> On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: > >> > >> > > >

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
ger ignored in >> replication, >> this bug goes away and correct results are reported on the slave. >> >> -Hank Eskin >> >> >> On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: >> >> > >> > This is a follow-up to my previous post. I have been nar

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Claudio Nanni
t; > -Hank Eskin > > > On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: > > > > > This is a follow-up to my previous post. I have been narrowing down what > > is causing this bug. It is a timing issue of a replication ignored table > > with an auto-increment pri

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
this bug goes away and correct results are reported on the slave. -Hank Eskin On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: > > This is a follow-up to my previous post. I have been narrowing down what > is causing this bug. It is a timing issue of a replication ignored table > with an

Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values leaking over into a non-ignored table with inserts immediately after the ignore table has had rows inserted

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Claudio Nanni
more > information as to what's causing it. I plan to write it up tomorrow and > post it. > > Basically, everything works perfectly, until I add a > "replication-ignore-table=xxx" statement in my.cnf where "xxx" is a > different table with a unique id INT

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hank
hing works perfectly, until I add a "replication-ignore-table=xxx" statement in my.cnf where "xxx" is a different table with a unique id INT auto-increment as the single primary key And then the values being inserted into the "test" table (above, not ignored) repres

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hal�sz S�ndor
2011/06/13 22:38 -0400, Hank But that bug report was closed two years ago. I have no idea if it's the server sending bad data or the slaves. I think it's the slaves, because on the slave error, it clearly is getting this statement: "insert into test values (1,null)" to replicate, but wh

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hank
gt; >> On Mon, Jun 13, 2011 at 10:33 PM, Claudio Nanni < > claudio.na...@gmail.com>wrote: > >> > >>> Hank, > >>> > >>> I can't reproduce it right now, > >>> But it really seems a bug. > >>> Just a shot in the d

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Claudio Nanni
>> >> >> On Mon, Jun 13, 2011 at 10:33 PM, Claudio Nanni wrote: >> >>> Hank, >>> >>> I can't reproduce it right now, >>> But it really seems a bug. >>> Just a shot in the dark, Are you sure you have statement based

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
hot in the dark, Are you sure you have statement based and not >> mixed replication? >> I don't even know if that would affect , just an idea. >> >> Claudio >> On Jun 14, 2011 3:07 AM, "Hank" wrote: >> > Hello All, >> > >> >

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
n't even know if that would affect , just an idea. > > Claudio > On Jun 14, 2011 3:07 AM, "Hank" wrote: > > Hello All, > > > > I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and > 5.5.8 > > 32 and 64-bit slaves (statement bas

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Claudio Nanni
All, > > I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 > 32 and 64-bit slaves (statement based replication). > > I'm finding an auto-increment field (part of a compound primary key) updates > correctly using "null" to insert the next value on

Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
Hello All, I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly using "null" to insert the next value on the master.

Re: How to protect primary key value on a web page?

2011-03-10 Thread Mark Kelly
Hi. On Thursday 10 Mar 2011 at 20:09 mos wrote: [snip] > Let's say I have a Document_Id column and the url is > www.mydocuments.com/public?docid=4 > to retrieve document_id=4, I don't want someone to write a program to > retrieve all of my public documents and download them. I want them to go >

Re: How to protect primary key value on a web page?

2011-03-10 Thread Shawn Green (MySQL)
espect. I am building a web application that uses MySQL 5.5 with Innodb tables and I don't want the user to see the actual primary key value on the web page. The primary key could be the cust_id, bill_id etc and is usually auto increment. This primary key can appear in the url and will be us

Re: How to protect primary key value on a web page?

2011-03-10 Thread Reindl Harald
column with a checksum deriving from the Id? what exactly do you not understand? fecth the record by its primary key is pretty fast decide the data-output by a checksum which is independent to the key how will you do this any other way? you can not use hash functions because you can not revert

Re: How to protect primary key value on a web page?

2011-03-10 Thread Claudio Nanni
On Mar 10, 2011 9:23 PM, "Reindl Harald" wrote: > > > > Am 10.03.2011 21:09, schrieb mos: > > At 12:37 PM 3/10/2011, Claudio Nanni wrote: > > > >> Hi there, > >> Yes I think its actually a pattern a few hundreds million sites solved already :) > > > > Great. How did they do it? :) > > > >> And any

Re: How to protect primary key value on a web page?

2011-03-10 Thread Claudio Nanni
sible. I'm hoping some >> > of you can offer me some ideas in this respect. >> > >> > I am building a web application that uses MySQL 5.5 with Innodb tables and >> > I don't want the user to see the actual primary key value on the web page. >> >

Re: How to protect primary key value on a web page?

2011-03-10 Thread Reindl Harald
Am 10.03.2011 21:09, schrieb mos: > At 12:37 PM 3/10/2011, Claudio Nanni wrote: > >> Hi there, >> Yes I think its actually a pattern a few hundreds million sites solved >> already :) > > Great. How did they do it? :) > >> And any way to encrypt (scramble)the http get string would do. But my

Re: How to protect primary key value on a web page?

2011-03-10 Thread mos
uses MySQL 5.5 with Innodb tables and > I don't want the user to see the actual primary key value on the web page. > The primary key could be the cust_id, bill_id etc and is usually auto > increment. This primary key can appear in the url and will be used to pull > up a record and dis

Re: How to protect primary key value on a web page?

2011-03-10 Thread Mike Diehl
On Thursday 10 March 2011 11:45:27 am Reindl Harald wrote: > Am 10.03.2011 18:10, schrieb mos: > > I am building a web application that uses MySQL 5.5 with Innodb tables > > and I don't want the user to see the actual primary key value on the web > > page. The primar

Re: How to protect primary key value on a web page?

2011-03-10 Thread Reindl Harald
Am 10.03.2011 18:10, schrieb mos: > I am building a web application that uses MySQL 5.5 with Innodb tables and I > don't want the user to see the actual > primary key value on the web page. The primary key could be the cust_id, > bill_id etc and is usually auto increment. &

Re: How to protect primary key value on a web page?

2011-03-10 Thread Claudio Nanni
; > I am building a web application that uses MySQL 5.5 with Innodb tables and > I don't want the user to see the actual primary key value on the web page. > The primary key could be the cust_id, bill_id etc and is usually auto > increment. This primary key can appear in the url and w

How to protect primary key value on a web page?

2011-03-10 Thread mos
ding a web application that uses MySQL 5.5 with Innodb tables and I don't want the user to see the actual primary key value on the web page. The primary key could be the cust_id, bill_id etc and is usually auto increment. This primary key can appear in the url and will be used to pull up a record an

Re: Two Identical Values on Primary Key Column

2011-03-02 Thread Rodrigo Ferreira
--+ 1 row in set (0.00 sec) mysql> --- On Wed, 3/2/11, Johan De Meersman wrote: From: Johan De Meersman Subject: Re: Two Identical Values on Primary Key Column To: "Rodrigo Ferreira" Cc: mysql@lists.mysql.com Date: Wednesday, March 2, 2011, 11:21 AM #yiv704254679 p {margin:0;}

Re: Two Identical Values on Primary Key Column

2011-03-02 Thread Johan De Meersman
wo Identical Values on Primary Key Column > Hi all, > I have just experienced a strange problem with mysql production > database. The table faqsessions have a primary key on column `Code` > and the above select return 2 rows! > mysql> > my

Two Identical Values on Primary Key Column

2011-03-02 Thread Rodrigo Ferreira
Hi all, I have just experienced a strange problem with mysql production database. The table faqsessions have a primary key on column `Code` and the above select return 2 rows! mysql> mysql> mysql> show create table fa

RE: Primary key not unique on InnoDB table

2010-10-15 Thread Travis Ard
join, indexing that column may not be a benefit. Running EXPLAIN will tell you whether or not the index you anticipate is actually being used for your query. -Travis From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Friday, October 15, 2010 3:43 AM To: [MySQL]; Travis Ard Subje

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 primar

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

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
I see what you mean. Infact this is wrong and I will be dropping the second field in the primary key. 2010/10/13 João Cândido de Souza Neto > A primary key with an auto_increment is ok, but I cant think about a > primary > key with two fiels where one of them is autoincrem

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
A primary key with an auto_increment is ok, but I cant think about a primary key with two fiels where one of them is autoincrement. Am I completely wrong? -- João Cândido de Souza Neto "Tompkins Neil" escreveu na mensagem news:aanlkti=xnjcaiq7bmoxg-q+4nowdhv8uaj9dcqrol...@mail

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Tompkins Neil
Sorry Joao, I thought that was pretty standard to have a primary key with auto_increment ?? 2010/10/13 João Cândido de Souza Neto > Sorry, the word is counpound instead of composed. > > -- > João Cândido de Souza Neto > > ""João Cândido de Souza Neto&qu

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
Sorry, the word is counpound instead of composed. -- João Cândido de Souza Neto ""João Cândido de Souza Neto"" escreveu na mensagem news:20101013144314.9787.qm...@lists.mysql.com... > I´d never seen before a composed primary key that has an auto_increment > fie

Re: Primary key not unique on InnoDB table

2010-10-13 Thread Jo�o C�ndido de Souza Neto
I´d never seen before a composed primary key that has an auto_increment field on it. May be I can be wrong but I think it wont work properly. As far 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

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: how to get the name of primary key ?

2010-02-01 Thread prabhat kumar
u can also get information of table using use> use urdbname mysql>show create table game_log \G 2010/2/1 曹凯 > > hi Jesper, > > > thanks a lot! That's what I want. thank u againCC: mysql@lists.mysql.com > From: jes...@noggin.com.au > Subject: Re: how to get

RE: how to get the name of primary key ?

2010-02-01 Thread 曹凯
hi Jesper, thanks a lot! That's what I want. thank u againCC: mysql@lists.mysql.com From: jes...@noggin.com.au Subject: Re: how to get the name of primary key ? Date: Mon, 1 Feb 2010 20:26:36 +1100 To: tx...@hotmail.com On 01/02/2010, at 7:33 PM, 曹凯 wrote: Hi all, if we just know the

Re: how to get the name of primary key ?

2010-02-01 Thread Jesper Wisborg Krogh
On 01/02/2010, at 7:33 PM, 曹凯 wrote: Hi all, if we just know the table name but don't know the name of primary key, is there any variables or constants could instead of the PK? for example: there is a table "game_log", and now I have the last inserted_id but don&

RE: how to get the name of primary key ?

2010-02-01 Thread 曹凯
Hi Thiyaghu, I have already got the last_insert_id. now I wanna know if there are any variables or constants to instead of game_log's primary key cos I don't know its name. > Date: Mon, 1 Feb 2010 14:24:59 +0530 > Subject: Re: how to get the name of primary key ?

Re: how to get the name of primary key ?

2010-02-01 Thread Thiyaghu CK
Hi, Use *SELECT * FROM game_log WHERE this_table's_PK = last_insert_id()* It will help you. Regards, Thiyaghu CK, MySQL DBA www.mafiree.com 2010/2/1 曹凯 > > Hi all, > > if we just know the table name but don't know the name of primary key, is > there any variables o

how to get the name of primary key ?

2010-02-01 Thread 曹凯
Hi all, if we just know the table name but don't know the name of primary key, is there any variables or constants could instead of the PK? for example: there is a table "game_log", and now I have the last inserted_id but don't know what its primary_id is, how can I &qu

Fwd: auto_increment without primary key in innodb?

2010-01-26 Thread Wagner Bianchi
Yeah, Paul... This is so clear...the auto_increment column may be indexed like: - KEY(); - UNIQUE(); - PRIMARY KEY() ...when you create or alter a table. -- Wagner Bianchi 2010/1/25 Paul DuBois The requirement is that it be indexed. The index need not be a primary key. > >

Re: auto_increment without primary key in innodb?

2010-01-26 Thread Johan De Meersman
On Mon, Jan 25, 2010 at 10:08 PM, Yong Lee wrote: > yah, mysql only allows one auto increment field n that's used as the > primary key in tables. I don't think it has to be the primary key as > long as it is a unique key i think that's okay. > > so u should be a

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Yong Lee
yah, mysql only allows one auto increment field n that's used as the primary key in tables. I don't think it has to be the primary key as long as it is a unique key i think that's okay. so u should be able to do : create table (myid int unsigned not null auto_increment., u

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Paul DuBois
The requirement is that it be indexed. The index need not be a primary key. mysql> create table t (i int not null auto_increment, index(i)) engine innodb; Query OK, 0 rows affected (0.45 sec) On Jan 25, 2010, at 9:39 AM, Yang Zhang wrote: > Right, I saw the docs. I'm fine with

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Jaime Crespo Rincón
2010/1/25 Yang Zhang : > Right, I saw the docs. I'm fine with creating an index on it, but the > only way I've successfully created a table with auto_increment is by > making it a primary key. And I still don't understand why this > requirement is there in the first pl

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Yang Zhang
Right, I saw the docs. I'm fine with creating an index on it, but the only way I've successfully created a table with auto_increment is by making it a primary key. And I still don't understand why this requirement is there in the first place. On Mon, Jan 25, 2010 at 10:32 AM, Tom

RE: auto_increment without primary key in innodb ?

2010-01-25 Thread Tom Worster
al Message- From: "Yang Zhang" Sent: Monday, January 25, 2010 10:21am To: mysql@lists.mysql.com Subject: auto_increment without primary key in innodb? In innodb, is it possible to have an auto_increment field without making it a (part of a) primary key? Why is this a requirement? I'm

auto_increment without primary key in innodb?

2010-01-25 Thread Yang Zhang
In innodb, is it possible to have an auto_increment field without making it a (part of a) primary key? Why is this a requirement? I'm getting the following error. Thanks in advance. ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as

Re: How to "REPLACE" updating when it's a subset of the primary key what is duplicated or inserting otherwise?

2009-10-07 Thread Fer C.
gt; INSERT INTO table (a,b,c) VALUES (1,2,3) >  ON DUPLICATE KEY UPDATE b=2,c=3; That has the same effect as REPLACE for me. The primary key is "a,b" so, it's possible that there's a (1,4,5) record already in the table that I want updated but INSERT ON DUPLICATE KEY UPDATE

Re: How to "REPLACE" updating when it's a subset of the primary key what is duplicated or inserting otherwise?

2009-10-07 Thread ewen fortune
Fernando, On Wed, Oct 7, 2009 at 5:08 PM, Fer C. wrote: > Hello > I have a table with a compound primary key (a1,a2) and I want to > insert a record (b1,b2) in th cases where there's no a1 value matching > b1, and if there's already a b1 value in the form (b1,c2) then just

How to "REPLACE" updating when it's a subset of the primary key what is duplicated or inserting otherwise?

2009-10-07 Thread Fer C.
Hello I have a table with a compound primary key (a1,a2) and I want to insert a record (b1,b2) in th cases where there's no a1 value matching b1, and if there's already a b1 value in the form (b1,c2) then just update it so that it turns into (b1,b2). So, If I want to insert-update the r

Re: Does InnoDB ever not cluster data by primary key?

2009-07-31 Thread Kyong Kim
Michael, We're counting on batch inserts of constant 2 leftmost columns of the primary key. We would be selecting within constant values for the leftmost columns as well. For example, our primary key is country_id, city_id, auto_inc, ... We'll always be looking for data from withi

Re: Does InnoDB ever not cluster data by primary key?

2009-07-30 Thread Michael Dykman
and had to > sacrifice on the length of the primary key. > And we got fairly good results from query profiling using maatkit. > One thing that shocked me was the overhead of random inserts primary > key updates. > It's definitely a tradeoff. > We're reasonably certain that

Re: Does InnoDB ever not cluster data by primary key?

2009-07-30 Thread Kyong Kim
Michael, Yeah. We're trying to maximize the benefits of clustering and had to sacrifice on the length of the primary key. And we got fairly good results from query profiling using maatkit. One thing that shocked me was the overhead of random inserts primary key updates. It's definitely

Does InnoDB ever not cluster data by primary key?

2009-07-30 Thread Kyong Kim
We have a multi-column primary key with an auto-increment column as the 3rd column in the primary key in InnoDB. Is there a requirement to have the auto-increment column as the leftmost column in the primary key in order for InnoDB to cluster by the multi-column primary key? I don't believe

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Gavin Towey
"I've run up on the rock of a binary (meaning: indecipherable) field." SELECT hex(some_binary_field) FROM table; Solved. The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of

RE: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Gavin Towey
y 2009 09:53:58 -0400 To: Ilia KATZ From: Fish Kungfu Cc: mysql@lists.mysql.com Subject: Re: MAC address as primary key - BIGINT or CHAR(12) Message-ID: --001636e90cddd7f9c70469dfa8fe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Since MAC addreses als

RE: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Daevid Vincent
e an IP like 192.168.0.0 now. Validate it. if ( false !== ip2long( $temp ) ) { $result = $temp."/".$cidr_bits; } } return $result; } /** * Returns true if the string is a valid CIDR. * * @access public * @param

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Pete Wilson
I agree, and didn't mean to say that I disagreed. This is certainly one of the top five principles to follow, imo. Too many times, while trouble-shooting, I've run up on the rock of a binary (meaning: indecipherable) field. What is the cost of including the binary representation (for indexing)

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Jim Lyons
er. > > I'll be interested in the answer, though, from someone with experience. > > -- Pete Wilson > http://www.pwilson.net/ > > > --- On Thu, 5/14/09, Jim Lyons wrote: > > > From: Jim Lyons > > Subject: Re: MAC address as primary key - BIGINT or CHAR(12) >

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Pete Wilson
be interested in the answer, though, from someone with experience. -- Pete Wilson http://www.pwilson.net/ --- On Thu, 5/14/09, Jim Lyons wrote: > From: Jim Lyons > Subject: Re: MAC address as primary key - BIGINT or CHAR(12) > To: "Ilia KATZ" > Cc: mysql@lists.mysql.

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Jim Lyons
e: > 1. MAC address defined as BIGINT > 2. MAC address set as primary key > > Should I consider changing it to CHAR(12)? > > Replies will be appreciated. > Ilia > > > > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Thomas Spahni
On Thu, 14 May 2009, Ilia KATZ wrote: Hi. Currently I have a table: 1. MAC address defined as BIGINT 2. MAC address set as primary key Should I consider changing it to CHAR(12)? Replies will be appreciated. Ilia Hi It depends. You may convert the MAC address to a decimal integer and store

RE: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Ilia KATZ
6th byte the last 2 bytes (of the BIGINT) left unused. Ilia From: Fish Kungfu [mailto:fish.kun...@gmail.com] Sent: Thursday, May 14, 2009 3:54 PM To: Ilia KATZ Cc: mysql@lists.mysql.com Subject: Re: MAC address as primary key - BIGINT or CHAR(12

RE: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Jerry Schwartz
a problem. >-Original Message- >From: Ilia KATZ [mailto:ik...@dane-elec.co.il] >Sent: Thursday, May 14, 2009 9:26 AM >To: mysql@lists.mysql.com >Subject: MAC address as primary key - BIGINT or CHAR(12) > >Hi. >Currently I have a table: >1. MAC address defined as BIGI

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread kabel
ress defined as BIGINT > 2. MAC address set as primary key > > Should I consider changing it to CHAR(12)? > > Replies will be appreciated. > Ilia And, if you use default charsets of anything else, make sure you set this column to CHARACTER SET ascii. A smaller index is a happi

Re: MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Fish Kungfu
Since MAC addreses also contain letters, BIGINT wouldn't work. So, yes, I would say go with CHAR(12). On May 14, 2009 9:43 AM, "Ilia KATZ" wrote: Hi. Currently I have a table: 1. MAC address defined as BIGINT 2. MAC address set as primary key Should I consider changin

MAC address as primary key - BIGINT or CHAR(12)

2009-05-14 Thread Ilia KATZ
Hi. Currently I have a table: 1. MAC address defined as BIGINT 2. MAC address set as primary key Should I consider changing it to CHAR(12)? Replies will be appreciated. Ilia

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
If you just don't want a primary key in your major data tables, then create a table for the express purpose of generating primary keys that uses auto_increment. Something like: create table myseq (x serial;) Each time you need a new key, get the next value from that table. It would be

Re: How to generate unique primary key in MySQL?

2009-04-27 Thread Michael Dykman
( > id VARCHAR(20) NOT NULL, > product_id INT NOT NULL, > product_quantity INT NOT NULL, > ... > ... > user_id INT NOT NULL, > current_timestamp TIMESTAMP, > primary key (id) > ); > > I will not use auto_increment > > Is there other way to generate unique pr

Re: How to generate unique primary key in MySQL?

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

How to generate unique primary key in MySQL?

2009-04-27 Thread yuan edit
I have a shopping cart table like this: CREATE TABLE shopping_cart( id VARCHAR(20) NOT NULL, product_id INT NOT NULL, product_quantity INT NOT NULL, ... ... user_id INT NOT NULL, current_timestamp TIMESTAMP, primary key (id) ); I will not use auto_increment Is there other way to generate

Re: Primary key / foreign key question

2008-11-10 Thread Martijn Tonies
Hello Steve, > Ok, I'm a little new a this, so be gentle!! :) > > I was looking into the InnoDB engine for some tables I have, and would like > to use the PK/FK on some of the data. > > It appears that the PK/FK is mainly used for updating/deleting data, > correct? I can't use it to retreive data

Primary key / foreign key question

2008-11-10 Thread Steve Grosz
Ok, I'm a little new a this, so be gentle!! :) I was looking into the InnoDB engine for some tables I have, and would like to use the PK/FK on some of the data. It appears that the PK/FK is mainly used for updating/deleting data, correct? I can't use it to retreive data from multiple tables

Re: select does too much work to find rows where primary key does not match

2008-04-16 Thread Joerg Bruehe
Hi Patrick, all ! Patrick J. McEvoy wrote: I have two MyISAM tables; each uses 'phone' as a primary key. Finding rows where the primary keys match is efficient: mysql> explain select bar.phone from foo,bar where foo.phone=bar.phone; [[...]} Ok, let us take some simple exampl

Re: select does too much work to find rows where primary key does not match

2008-04-15 Thread Patrick J. McEvoy
> I would have thought your not = though is matching a lot more rows every > time.. The field is UNIQUE PRIMARY KEY in both tables, so there should be 0 or 1 matches. > I would look into using where not exists as a subselect My MySQL book (O'Reilly second edition) does not ment

Re: select does too much work to find rows where primary key does not match

2008-04-15 Thread ddevaudreuil
one = > bar.phone); > > something like that. > > On Tue, Apr 15, 2008 at 5:00 PM, Patrick J. McEvoy <[EMAIL PROTECTED]> > wrote: > > > I have two MyISAM tables; each uses 'phone' as a primary key. Finding rows > > where the primary keys match

Re: select does too much work to find rows where primary key does not match

2008-04-15 Thread Phil
J. McEvoy <[EMAIL PROTECTED]> wrote: > I have two MyISAM tables; each uses 'phone' as a primary key. Finding rows > where the primary keys match is efficient: > > mysql> explain select bar.pho

  1   2   3   4   5   6   >