Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
I have a InnoDB table which contains columns named 'cluster' and 'file' ('cluster' + 'file' is a primary key). I want to add a new column that tracks the revision number of a file for a given cluster and a file. The situation is tailor made for a MyIsam table where I can add a new Auto

RE: DBA questions to ask WAS: How to corrupt a database please???

2010-04-22 Thread Daevid Vincent
-Original Message- From: Nurudin Javeri [mailto:nsjav...@idh.com] Sent: Sunday, April 18, 2010 9:25 AM To: mysql@lists.mysql.com Subject: How to corrupt a database please??? Hi all, I am hiring a few new junior DBA's and I want to put them thru a simple db repair training.

Re: Fw: BIN LOG Error when use Begin Trans in Replication.

2010-04-22 Thread Vikram A
Hi Max Bube, The following are the variables related to the binlog. mysqlshow variables varibale_name : Value . . . binlog_cache_size : 32768 binlog_direct_non_transactional_updates : OFF binlog_format : STATEMENT . . . By default I found the statement based[it is better than row based?] format

Re: Fw: BIN LOG Error when use Begin Trans in Replication.

2010-04-22 Thread Vikram A
hi, I tried with ROW and MIXED tyoe it is working fine. When i go for statement based, it is causing the error. mysql SET GLOBAL binlog_format = 'STATEMENT'; mysql SET GLOBAL binlog_format = 'ROW'; mysql SET GLOBAL binlog_format = 'MIXED'; can you suggest Which is the best format? Thank you

Re: More CPU or More RAM?

2010-04-22 Thread Johan De Meersman
On Wed, Apr 21, 2010 at 4:52 PM, shamu...@gmail.com shamu...@gmail.comwrote: replacement etc, but that costs me too much if I can use hardware to solve the same problem. and Yes I know I will run to same problem again when the It may be that you can't actually solve it with more hardware. The

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
You can't, iirc - if you add an autoincrement to InnoDB it MUST be the primary key. You *can*, however, add that, set it as PK and stick a unique index on (cluster, file) instead. Behaviour will be identical, but be aware that there will be some performance implications - you will now have to do

Re: More CPU or More RAM?

2010-04-22 Thread Rudy Lippan
On 04/21/2010 02:21 PM, Tom Worster wrote: I'd go with the 4G 4-core server. If you're running apache and a sensible OS, the extra cores can be helpful. So, unless you know you have a need for very large key buffers, 4G should leave the OS plenty for FS cache. Not that I actually have a

Re: More CPU or More RAM?

2010-04-22 Thread Johan De Meersman
Also, have some munin plugins. There are the ones I add to the ones in a standard munin distribution, and give plenty of info. Only the mysql_ one is actually mine, I got the rest off muninexchange. Guess I should incorporate their functionality into mine sometime. A good look at the data that

backup: mysqldump or mysqlhotcopy ?

2010-04-22 Thread Lentes, Bernd
hello, i'm new to MySQL, so i have currently some basic questions. I have a MySQL-Server with 15 users. Every User can create databases. I expect that the amount of data which has to be backuped will increase constantly. What i want: I'd like to have a backup on a regular basis. I think i will

ANN: New version of Database Workbench, the multi-DBMS IDE now available!

2010-04-22 Thread Martijn Tonies
Ladies, gentlemen, Upscene Productions is proud to announce the next version of the popular multi-DBMS development tool: Database Workbench 4.0 Pro With this version we're reached a milestone: Database Workbench is now fully Unicode enabled and offers new tools to increase your

Re: Fw: BIN LOG Error when use Begin Trans in Replication.

2010-04-22 Thread Max Bube
Hi Vikram, Add binlog_format=row to your my.ini master's conf file 2010/4/21 Vikram A vikkiatb...@yahoo.in Hi Hao Ding, I attached in my request mail it self. Please find the attachment. Thank you -- *From:* hao ding fire9di...@gmail.com *To:* Vikram A

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
I am not sure I understand. If I make the autoincrement column as part of the primary key as (rev + cluster + file), how do I ensure that a reset of the revision number is done as soon as (cluster + file) combination changes? It looks like I need to do the following to mimic the same behavior

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 12:09 PM, Aveek Misra ave...@yahoo-inc.com wrote: I am not sure I understand. If I make the autoincrement column as part of the primary key as (rev + cluster + file), how do I ensure that a reset of the revision number is done as soon as (cluster + file) combination

SQL_BIG_RESULT being ignored?

2010-04-22 Thread kabel
Using 5.0.51, I have a fairly substantial SELECT ... GROUP BY query to which I have added the SQL_BIG_RESULT hint. According to the 5.0 SELECT manual, SQL_BIG_RESULT can be used with GROUP BY or DISTINCT to tell the optimizer that the result set has many rows. In this case, MySQL directly uses

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
MyISAM has this really cool feature where you can specify autoincrement on a secondary column in a multiple column index. In such a case the generated value for the autoincrement column is calculated as MAX(autoincrement column) + 1 WHERE prefix='given-prefix'. For more refer to

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
Kudos for managing to drag up such an obscure piece of functionality :-) I can see where it would be useful, though. As to your question, though: given that that page indicates that it will reuse deleted sequence numbers, I think your best bet would be select @id := count(*)+1 from table where

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
How can count(*) in an InnoDB table be faster than MAX() considering that the former needs to do a table scan and the latter can use an index if correctly used? My code starts the sequence from 1. Thanks Aveek Johan De Meersman wrote: Kudos for managing to drag up such an obscure piece of

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
The count happens after the where on an index - it should just count the appropriate index rows without looking at the values. Worth benchmarking on your dataset, though. On Thu, Apr 22, 2010 at 1:22 PM, Aveek Misra ave...@yahoo-inc.com wrote: How can count(*) in an InnoDB table be faster than

Re: Auto Increment in InnoDB

2010-04-22 Thread Carsten Pedersen
On Thu, 22 Apr 2010 13:12:16 +0200, Johan De Meersman vegiv...@tuxera.be wrote: Kudos for managing to drag up such an obscure piece of functionality :-) I can see where it would be useful, though. As to your question, though: given that that page indicates that it will reuse deleted

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen cars...@bitbybit.dkwrote: Wouldn't that strategy cause problems if one or more rows have been deleted in the meantime? (i.e. sequence numbers 1-4 have been created, row 2 has been deleted - new sequence number would be 4). Yeps. I'm none too

Re: Auto Increment in InnoDB

2010-04-22 Thread mos
At 12:03 AM 4/22/2010, Aveek Misra wrote: I have a InnoDB table which contains columns named 'cluster' and 'file' ('cluster' + 'file' is a primary key). I want to add a new column that tracks the revision number of a file for a given cluster and a file. The situation is tailor made for a

Speeding up inserts in InnoDB

2010-04-22 Thread Chris W
I have a very simple table. CREATE TABLE `hams`.`phoneticcallsign` ( `CallSign` char(6) NOT NULL, `PhoneticCallSign` char(6) NOT NULL, PRIMARY KEY (`CallSign`), KEY `PhoneticIdx` (`PhoneticCallSign`) USING BTREE ) I inserted a little over 1 million records with CallSign = to a value from

Re: Auto Increment in InnoDB

2010-04-22 Thread Chris W
Johan De Meersman wrote: On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen cars...@bitbybit.dkwrote: Wouldn't that strategy cause problems if one or more rows have been deleted in the meantime? (i.e. sequence numbers 1-4 have been created, row 2 has been deleted - new sequence number would

Re: Speeding up inserts in InnoDB

2010-04-22 Thread Johnny Withers
I'm a little confused.. are the inserts slow, or are the updates slow? It sounds like you mean the updates were going about 50/updates sec. You could speed up the update by adding an index on phoneticcallsign.CallSign. JW On Thu, Apr 22, 2010 at 10:13 AM, Chris W 4rfv...@cox.net wrote: I have

Re: Speeding up inserts in InnoDB

2010-04-22 Thread Chris W
Sorry I misspoke, I am doing updates not inserts. If I was doing inserts I thought about the multiple record at a time idea but unless there is something I don't know, I don't think you can do that with updates. I will look into turning autocommit off and see what that does. Chris W.

Loading 4.1.12 dump to 5.0.18 server

2010-04-22 Thread Larry Martell
I need to load a dump from a 4.1.12 server to a 5.0.18 server. When I do that it fails with: ERROR 1064 (42000) at line 23: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BTREE

First and Last timestamp of the day/week / month

2010-04-22 Thread Cantwell, Bryan
I need to be able to get a first and last timestamp for a day a week or a month. I have an example of what I did so far that gets me that info for a week... but I fear that it is far more complex than it needs to be. Anyone have a simple way to get first and last timestamp for these intervals?

Re: First and Last timestamp of the day/week / month

2010-04-22 Thread Alister West
You could rewrite it english friendly (5.1.37) SET @DAY_START = curdate(); SET @WEEK_START = curdate() - interval weekday(now()) DAY; SET @MONTH_START = date_format(curdate(), %Y-%m-01); ## DAY SELECT timestamp(@DAY_START) as min_ts, timestamp(@DAY_START + INTERVAL 1 DAY

Re: Loading 4.1.12 dump to 5.0.18 server

2010-04-22 Thread Shawn Green
Larry Martell wrote: I need to load a dump from a 4.1.12 server to a 5.0.18 server. When I do that it fails with: ERROR 1064 (42000) at line 23: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BTREE

Re: Loading 4.1.12 dump to 5.0.18 server

2010-04-22 Thread Rob Wultsch
On Thu, Apr 22, 2010 at 1:42 PM, Larry Martell larry.mart...@gmail.com wrote: I need to load a dump from a 4.1.12 server to a 5.0.18 server. When I do that it fails with: Upgrading from an early 4.1 series to an incredibly early 5.0 series is a bad idea. Your first priority should be