RE: Index help

2007-11-12 Thread Rob Wultsch
On Nov 8, 2007 4:08 PM, Stut [EMAIL PROTECTED] wrote: Hi all, I've inherited a PHP app that uses a MySQL database. The following query is extremely slow and I've been battling for a couple of days on an off to try and get a combination of indexes to optimise it. Any help would be greatly

Re: Index help

2007-11-12 Thread Stut
Hi Rob, Thanks for your reply. Rob Wultsch wrote: On Nov 8, 2007 4:08 PM, Stut [EMAIL PROTECTED] wrote: Hi all, I've inherited a PHP app that uses a MySQL database. The following query is extremely slow and I've been battling for a couple of days on an off to try and get a combination of

Re: Index help

2007-11-12 Thread Rob Wultsch
On Nov 12, 2007 7:57 AM, Stut [EMAIL PROTECTED] wrote: Hi Rob, Thanks for your reply. Rob Wultsch wrote: On Nov 8, 2007 4:08 PM, Stut [EMAIL PROTECTED] wrote: Hi all, I've inherited a PHP app that uses a MySQL database. The following query is extremely slow and I've been battling

Re: Index help

2007-11-12 Thread Rob Wultsch
On Nov 12, 2007 9:22 AM, Afan Pasalic [EMAIL PROTECTED] wrote: If you have to deal with it again consider using a bunch of unions instead of the 'IN'. Not prettiest thing, but it should fix your performance issue. Could you please give me more details about your statement that mysql deals

Transactions and locking

2007-11-12 Thread Yves Goergen
Hi, there's very much information about how transactions and locking works in InnoDB, but maybe there's also a simple and understandable answer to my simple question: When I start a transaction, then find the maximum value of a column and use that + 1 to write a new row into the table, how do

Re: Transactions and locking

2007-11-12 Thread Martijn Tonies
Hello Yves, there's very much information about how transactions and locking works in InnoDB, but maybe there's also a simple and understandable answer to my simple question: When I start a transaction, then find the maximum value of a column and use that + 1 to write a new row into the

Re: Transactions and locking

2007-11-12 Thread Perrin Harkins
On Nov 12, 2007 1:25 PM, Yves Goergen [EMAIL PROTECTED] wrote: When I start a transaction, then find the maximum value of a column and use that + 1 to write a new row into the table, how do transactions protect me from somebody else doing the same thing so that we'd both end up writing a new

Re: Transactions and locking

2007-11-12 Thread Yves Goergen
Okay, I feel like I need to clarify some things. I do have a UNIQUE INDEX constraint on those columns, so the other user won't actually write the same value another time, but it will fail at a level which it should not. I don't want to use AUTO_INCREMENT because it's not portable. My application

which duplicate key was hit on last insert?

2007-11-12 Thread Lev Lvovsky
We have tables in our database that, in addition to primary key constraints also have unique() constraints of several columns in the table: CREATE TABLE Test ( COL1INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, COL2VARCHAR(10) NOT NULL, COL3VARCHAR(10) NOT NULL,

Simple Query

2007-11-12 Thread Ben Wiechman
I need help writing what is probably a rather simple query. I have two tables. The first contains several columns, but most importantly an id column. The second is has two columns, an id that corresponds with the id in the first table, and a value. For every row in the first table I'd

Re: Transactions and locking

2007-11-12 Thread Perrin Harkins
On Nov 12, 2007 2:43 PM, Yves Goergen [EMAIL PROTECTED] wrote: SELECT COUNT(*) FROM table WHERE name = ? -- a short delay which is long enough for a concurrent request :( UPDATE table SET name = ? WHERE id = ? I think that even with SERIALIZABLE isolation level, this won't lock anything if it

Re: Transactions and locking

2007-11-12 Thread Yves Goergen
On 12.11.2007 20:43 CE(S)T, Yves Goergen wrote: I'll have a look at those isolation levels though. Maybe it's what I'm looking for. Not quite. But I'm going the LOCK TABLES way now. Locking a single table exclusively for those rare moments seems to be the best solution. I could also implement

Re: Simple Query

2007-11-12 Thread Peter Brawley
I tried this but it is not working. I'm not very familiar with subqueries as you can see. insert into table_2 ( id, value ) values ( (select id from table_1), '1' ); insert into table_2 (id,value) select id,1 from table_1; PB Ben Wiechman wrote: I need help writing what is probably a

Processlist full of Opening tables

2007-11-12 Thread Samuel Vogel
Hey guys, I do run MySQL on a high traffic Server with approximately 10k databases. Since some time MySQL is has become very sluggish. When I look at my processlist it shows more than 25 processes (sometimes of the same table) with status Opening tables. Some processes also show closing

Re: Transactions and locking

2007-11-12 Thread Yves Goergen
On 12.11.2007 22:16 CE(S)T, Yves Goergen wrote: Since I only need these locks for a very short time and a single table with no transaction support, this works fine for me. Damn, I found out that I need table locking *and* transactions. I'm lost... Maybe I'm really better off using a sequence

secure mysql port

2007-11-12 Thread Kelly Opal
Hi Is there any way to restrict access to the tcp port on mysql. I only want my 5 class C's to be able to access the port but it is a public server. Any help would be greatly appreciated. Kelly -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: Transactions and locking

2007-11-12 Thread Perrin Harkins
On Nov 12, 2007 5:24 PM, Yves Goergen [EMAIL PROTECTED] wrote: Damn, I found out that I need table locking *and* transactions. What makes you say that? Maybe I'm really better off using a sequence (like the one PostgreSQL offers and like it is available as an add-on for Perl [1]). That Perl

Re: Transactions and locking

2007-11-12 Thread Yves Goergen
On 12.11.2007 23:31 CE(S)T, Perrin Harkins wrote: On Nov 12, 2007 5:24 PM, Yves Goergen [EMAIL PROTECTED] wrote: Damn, I found out that I need table locking *and* transactions. What makes you say that? BEGIN TRANSACTION SELECT MAX(id) FROM table INSERT INTO table (id) VALUES (?) INSERT INTO

Re: Transactions and locking

2007-11-12 Thread Perrin Harkins
On Nov 12, 2007 5:58 PM, Yves Goergen [EMAIL PROTECTED] wrote: BEGIN TRANSACTION SELECT MAX(id) FROM table INSERT INTO table (id) VALUES (?) INSERT INTO othertable (id) VALUES (?) COMMIT First I find a new id value, then I do several INSERTs that need to be atomic, and especially roll back

errror while installing DBD::MYSQL.

2007-11-12 Thread Siva Prasad
Hi All, I don't know whether it is correct group or not. Just a hope that I may get solution. I have installed DBI and when I run the following perl script; --SCRIPT use strict; use warnings; use DBI; my $DSN=DBI:mysql:database=faculte;host=localhost;port=3306; my

Re: which duplicate key was hit on last insert?

2007-11-12 Thread Michael Dykman
On Nov 12, 2007 6:42 PM, Lev Lvovsky [EMAIL PROTECTED] wrote: We have tables in our database that, in addition to primary key constraints also have unique() constraints of several columns in the table: CREATE TABLE Test ( COL1INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, COL2