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 SELECT * FROM game_log

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 曹凯 tx...@hotmail.com Hi all, if we just know the table name but don't know the name of primary key, is there any variables or constants

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

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't know what its

Re: extend via table VS extend via database

2010-02-01 Thread Johan De Meersman
If you have performance problems, and no slowlog, maybe it just isn't enabled in your config ? Your indexes may not have changed, but the size of your data has. A query that does a full tablescan will run acceptably on a few thousand records, but be damn slow on a few million - especially as soon

Re: 50 things to know before migrating from Oracle to MySQL

2010-02-01 Thread Martijn Tonies
Martijn Tonies wrote: database. I would also bet that 80% of the people who are actually writing queries with that many joins don't have a solid grasp of the fundamental principles of relational database design. Why not? Normalizing gets you -more- tables, not less. And normalizing is a

Re: 50 things to know before migrating from Oracle to MySQL

2010-02-01 Thread Martijn Tonies
Tom, I noticed the article didn't say how much money you'll save by not paying through the nose for Oracle per server licensing, the cost of upgrading your hardware to get some speed out of Oracle, or the cost of having to hire one or more Oracle administrators to manage and tweak the database.

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 table

Re: 50 things to know before migrating from Oracle to MySQL

2010-02-01 Thread Jigal van Hemert
Martijn Tonies wrote: Martijn Tonies wrote: database. I would also bet that 80% of the people who are actually writing queries with that many joins don't have a solid grasp of the fundamental principles of relational database design. Why not? Normalizing gets you -more- tables, not less.

Is table_open_cache a private cache of a session?

2010-02-01 Thread Cui Shijun
hi, I'm a little confused by the document(http://dev.mysql.com/doc/refman/5.1/en/table-cache.html), which only says: To minimize the problem with multiple client sessions having different states on the same table, the table is opened independently by each concurrent session. Are sessions using

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 mysqlshow create table game_log \G 2010/2/1 曹凯 tx...@hotmail.com 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 ?

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Johan De Meersman
On Mon, Feb 1, 2010 at 2:21 PM, Cui Shijun rancp...@gmail.com wrote: To minimize the problem with multiple client sessions having different states on the same table, the table is opened independently by each concurrent session. That literally means that every time a table gets referenced, it

Selecting Dates

2010-02-01 Thread ML
Hi All, Switching from Oracle to MySQL, I seem to be having some difficulty selecting dates using between or even where = and = like: SELECT * FROM orders WHERE order_date BETWEEN='2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date ='2010-01-01' AND =

Re: Selecting Dates

2010-02-01 Thread Lucky Wijaya
Just trying to help. SELECT * FROM orders WHERE order_date BETWEEN '2010-01-01' AND '2010-01-30' ORDER BY order_date; or SELECT * FROM orders WHERE order_date = '2010-01-01' AND = '2010-01-30' ORDER BY order_date; From: ML mailingli...@mailnewsrss.com

Re: Selecting Dates

2010-02-01 Thread sureshkumarilu
Hi What is the datatype of the column order_date. Give the full form of the date for the between condition. Thanks Suresh Kuna MySQL DBA --Original Message-- From: ML To: mysql@lists.mysql.com Subject: Selecting Dates Sent: Feb 1, 2010 7:05 AM Hi All, Switching from Oracle to MySQL, I

Re: Selecting Dates

2010-02-01 Thread Jim Lyons
Shouldn't it be: SELECT * FROM orders WHERE order_date = '2010-01-01' AND order_date = '2010-01-30' ORDER BY order_date; ? change the = and repeat the column_name. Datetime should be datetime or timestamp; On Mon, Feb 1, 2010 at 8:25 AM, sureshkumar...@gmail.com wrote: Hi What is the

Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Dante Lorenso
All, I am trying to create an atomic operation in MySQL that will manage a queue. I want to lock an item from a table for exclusive access by one of my processing threads. I do this by inserting the unique ID of the record I want to reserve into my cli_lock table. The following query is what I

Query Question

2010-02-01 Thread Dirk Bremer
For the given table: FIELD TYPE COLLATION NULL KEY DEFAULT Extra PRIVILEGES COMMENT - -- -- --- --

Re: 50 things to know before migrating from Oracle to MySQL

2010-02-01 Thread Martijn Tonies
database. I would also bet that 80% of the people who are actually writing queries with that many joins don't have a solid grasp of the fundamental principles of relational database design. Why not? Normalizing gets you -more- tables, not less. And normalizing is a goal in itself? I've seen

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Michael Dykman
The query is probably fine.. that is just the lock doing it's job. Take that advice literally.. when you fail with that class of exception, delay a milli-second or two and retry. For a large PHP site I designed, we had that behaviour built-in: up to three attempts waits 5, then 10 ms between

Re: 50 things to know before migrating from Oracle to MySQL

2010-02-01 Thread Michael Dykman
Oracle will sell it if they can convince the customer. Any one who has had the pleasure of using Oracle Application Server can attest to that. -- - michael dykman - mdyk...@gmail.com May the Source be with you. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql

Re: Selecting Dates

2010-02-01 Thread ML
Jim, Shouldn't it be: SELECT * FROM orders WHERE order_date = '2010-01-01' AND order_date = '2010-01-30' ORDER BY order_date; ? change the = and repeat the column_name. Datetime should be datetime or timestamp; Spot on. Thank you for the clarification, obviously a syntax mistake on

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Johan De Meersman
First things first: You *are* on InnoDB, which has row-level locking instead of table-level ? On Mon, Feb 1, 2010 at 4:08 PM, Michael Dykman mdyk...@gmail.com wrote: The query is probably fine.. that is just the lock doing it's job. Take that advice literally.. when you fail with that class

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Cui Shijun
hi, This post( http://bugs.mysql.com/bug.php?id=48929 ) shows that If the number of opened file grows too big, mysql will get error. I'm also confused by the difference relationship between open table and open file descriptor by the table cache. As far as I understand, when a thread ask the

Re: WAMP vs LAMP

2010-02-01 Thread Shawn Green
Jerry Schwartz wrote: From: Wagner Bianchi [mailto:wagnerbianch...@gmail.com] Sent: Thursday, January 28, 2010 2:03 PM To: Jerry Schwartz Subject: Re: WAMP vs LAMP [JS] The file paths were all the same, actually, and the address for MySQL is just “localhost”. [WB]Consider to use MySQL on

RE: WAMP vs LAMP

2010-02-01 Thread Jerry Schwartz
Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com From: Wagner Bianchi [mailto:wagnerbianch...@gmail.com] Sent: Friday, January 29, 2010 5:49 PM To: Jerry

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Johan De Meersman
On Mon, Feb 1, 2010 at 4:51 PM, Cui Shijun rancp...@gmail.com wrote: I'm also confused by the difference relationship between open table and open file descriptor by the table cache. open table is a MySQL concept. Open file descriptor is an OS concept. A single table (MyISAM) consists of

RE: WAMP vs LAMP

2010-02-01 Thread Jerry Schwartz
Thanks for the clarification. As I understand it, the syntax on the client end is to use . as the host name. I was using localhost on the LAMP configuration, and never bothered to change it. With 7 or so web-based users, there isn't much rush. Regards, Jerry Schwartz The Infoshop by Global

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Cui Shijun
Got your idea. Thank you very much. Now I know how table cache works :-) For the bug, yes, it's related to the value of FD_SETSIZE, which is limited to 1024 at my RedHat box. Maybe I should update it to a suitable value. 2010/2/2 Johan De Meersman vegiv...@tuxera.be: On Mon, Feb 1, 2010

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Wagner Bianchi
Is FD_SETSIZE regards to an open_file_limit? WB 2010/2/1 Cui Shijun rancp...@gmail.com Got your idea. Thank you very much. Now I know how table cache works :-) For the bug, yes, it's related to the value of FD_SETSIZE, which is limited to 1024 at my RedHat box. Maybe I should update it

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Wagner Bianchi
Sorry, *open_files_limit... 2010/2/1 Wagner Bianchi wagnerbianch...@gmail.com Is FD_SETSIZE regards to an open_file_limit? WB 2010/2/1 Cui Shijun rancp...@gmail.com Got your idea. Thank you very much. Now I know how table cache works :-) For the bug, yes, it's related to the value

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread D. Dante Lorenso
Johan De Meersman wrote: First things first: You *are* on InnoDB, which has row-level locking instead of table-level ? Yes, both cli_lock and queue tables are InnoDB. The server is running MySQL 5.1.36. I find it strange that I would have so many of these deadlocks throughout a day when

Re: Is table_open_cache a private cache of a session?

2010-02-01 Thread Cui Shijun
FD_SETSIZE is defined at /usr/include/linux/posix_types.h and /usr/include/bits/typesizes.h ... Set open_files_limit bigger is a way to let mysql use more file descriptors( and thus has the chance to reach the FD_SETSIZE limit ) Also notice in the bug description, innodb_open_files was used,

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread D. Dante Lorenso
Michael Dykman wrote: The query is probably fine.. that is just the lock doing it's job. Take that advice literally.. when you fail with that class of exception, delay a milli-second or two and retry. For a large PHP site I designed, we had that behaviour built-in: up to three attempts waits

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Michael Dykman
The SELECT FOR UPDATE is supposed to lock those rows selected.. an operation in another connection attempting to read or modify those rows gets an error on the lock if it is still in place. That is that SELECT FOR UPDATE is supposed to do. If that is not the behaviour you want, then why are

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Jesper Wisborg Krogh
Try to run SHOW ENGINE INNODB STATUS; Near the top there will be some information on the latest deadlock. That might help you to understand what is deadlocking. Sometimes changing the query or changing the indexes can remove the condition that causes the deadlock. I don't know whether you

Re: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

2010-02-01 Thread Madonna DeVaudreuil
May I suggest this link? I found it useful. I haven't looked but there may be more recent posts with additional information. http://www.xaprb.com/blog/2007/09/18/how-to-debug-innodb-lock-waits/ Donna From: Jesper Wisborg Krogh jes...@noggin.com.au To: mysql@lists.mysql.com Date:

I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread kebede teferi
Hi, I'm very new to this and I need help. What I want to do is to execute a source command statement from cmd to create tables and populate them on a data base that I created in Mysql.  Here is what I did at CMD: *I changed the directory from c:\ to mysql *At mysql prompt i used -u root -p that

Re: I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread Jesper Wisborg Krogh
How did you type the source command? Did you remember not to quote the file name? E.g. mysql SOURCE schema.sql is the correct way. Jesper On Tue, 2 Feb 2010 10:38:08 kebede teferi wrote: Hi, I'm very new to this and I need help. What I want to do is to execute a source command statement

Re: I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread John List
On 02/01/2010 06:38 PM, kebede teferi wrote: Hi, I'm very new to this and I need help. What I want to do is to execute a source command statement from cmd to create tables and populate them on a data base that I created in Mysql. Here is what I did at CMD: *I changed the directory from c:\

Re: I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread Carlos Proal
Error 2 is No such file or directory So, probably the file is not in the right path or you need to explicitly provide the path to the file. Carlos On 2/1/2010 5:38 PM, kebede teferi wrote: Hi, I'm very new to this and I need help. What I want to do is to execute a source command

Re: I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread Colin Streicher
what everyone else said... also, is there a longer version of the error? or is it literally error 2 or error 22? Colin On February 1, 2010 06:38:08 pm kebede teferi wrote: Hi, I'm very new to this and I need help. What I want to do is to execute a source command statement from cmd to

Re: I NEED HELP ON 'SOURCE(\.) MYSQL

2010-02-01 Thread sureshkumarilu
Give the ful path of file name with in '' and try it out Thanks Suresh Kuna MySQL DBA --Original Message-- From: Colin Streicher To: mysql@lists.mysql.com Cc: kebede teferi ReplyTo: co...@obviouslymalicious.com Subject: Re: I NEED HELP ON 'SOURCE(\.) MYSQL Sent: Feb 2, 2010 7:33 AM what

MY PROBLEM WITH THE SOURCE(\.) IS SOLVED

2010-02-01 Thread kebede teferi
I thank you all who responded to solve my problem in using the source command to execute a mysql script saved on a notepad.  Thank you, for your tips, I've solved the problem.  When I was using the \.create.sql at the prompt I wasn't giving the full path where 'create.sql' is residing.  Once I

hi help to take backup-mysql-windows-xp

2010-02-01 Thread muralikrishna g
hi to all.. i was in need to take backup of database.. i am using sql server version:5.0.27-coomunity-nt i have tried by using mysqldump -u name -p password database_name backup.sql; but i am getting error.. i am using windows xp system.. please help me

Re: hi help to take backup-mysql-windows-xp

2010-02-01 Thread Suresh Kuna
Please paste the error and don't give the spave between -p and password. On Tue, Feb 2, 2010 at 12:05 PM, muralikrishna g muralikrishn...@gmail.comwrote: hi to all.. i was in need to take backup of database.. i am using sql server version:5.0.27-coomunity-nt i have tried by using mysqldump

Re: hi help to take backup-mysql-windows-xp

2010-02-01 Thread muralikrishna g
hi to all.. i was in need to take backup of database.. i am using sql server version:5.0.27-coomunity-nt i have tried by using mysqldump -u name -p password database_name backup.sql; but i am getting error.. i am using windows xp system.. please help me mysql mysqldump -u root -p dbadmin murali

Re: hi help to take backup-mysql-windows-xp

2010-02-01 Thread sureshkumarilu
Hi Murali, You have to execute it outside mysql prompt i.e command prompt. Thanks Suresh Kuna MySQL DBA Sent from BlackBerry® on Airtel -Original Message- From: muralikrishna g muralikrishn...@gmail.com Date: Tue, 2 Feb 2010 12:17:24 To: Suresh Kunasureshkumar...@gmail.com Cc:

RE: hi help to take backup-mysql-windows-xp

2010-02-01 Thread Parikh, Dilip Kumar
Hey guys Try using this option from the command prompt via run Mysqldump.exe -u root -p --all-database backup.txt This should work. Thanks, Dilipkumar Database Engineering  phone: +91-44-6637 3167  mailto: dilipkumar.par...@eds.com Pager mail:9884430...@nma.vodafone.in -Original