Re: how to optimize mysql in easy way

2011-10-22 Thread mos
At 05:49 AM 10/21/2011, you wrote: how to optimize mysql in easy way step, i know indexing, mapping other than that is any way. -- Thanks Regards, P.Benaya Paul Apart from enrolling in Hogwarts, you may be interested in the book High Performance MySQL 2nd Edition. It can be found

how to optimize mysql in easy way

2011-10-21 Thread Benaya Paul
how to optimize mysql in easy way step, i know indexing, mapping other than that is any way. -- Thanks Regards, P.Benaya Paul http://www.codeasearch.com http://www.iwannasearch.com

Re: how to optimize mysql in easy way

2011-10-21 Thread Johan De Meersman
- Original Message - From: Benaya Paul benayap...@gmail.com how to optimize mysql in easy way step, i know indexing, mapping other than that is any way. Forsooth, three paths extend before thee. The right way is to learn about mysql so you know what you're doing. The intermediate

Re: How to optimize a slow query?

2009-09-07 Thread Jia Chen
Hi Mike, Thanks for you help! Best, Jia mos wrote: Jia, The code you sent seems to be able to get the job done. You could try something simpler by executing 2 sql statements instead of using one. Something like: create table rmpdata1 select ri.*, mv.* from RItime as ri left join

Re: How to optimize a slow query?

2009-09-06 Thread Jia Chen
Thanks for your reply, Mike. Yes, 13419851 rows were added to rmpdata1. However, 10 minutes seem to be too long. I run the same join by using SQL procedure in a statistical software called SAS on a similar machine. It only takes 1 minute and 3 seconds. Yes, it is a 1:1 relationship between

Re: How to optimize a slow query?

2009-09-06 Thread mos
Jia, Yes, it is a 1:1 relationship between table RItime and MVtime. However, I don't get your suggestion, I'd recommend joining the two tables into 1 table so you don't have to join them in the first place. Could you elaborate that? Sure but first I have to relate it to my own experience.

Re: How to optimize a slow query?

2009-09-06 Thread Jia Chen
Hi Mike, Thanks for your detailed answer. Now, I understand what you mean. And, yes, I agree with you that keeping all data in one table works better for a bunch of 1:1 relationship tables. Actually, this is what I was trying to do with that query. Since you mention They all had a 1:1

Re: How to optimize a slow query?

2009-09-06 Thread mos
Jia, The code you sent seems to be able to get the job done. You could try something simpler by executing 2 sql statements instead of using one. Something like: create table rmpdata1 select ri.*, mv.* from RItime as ri left join MVtime as mv on (ri.code=mv.code and ri.ndate=mv.ndate));

How to optimize a slow query?

2009-09-05 Thread Jia Chen
Hi there, One simple query took more than 10 minutes. Here is how relevant rows in the slow query log looks like: # Time: 090905 10:49:57 # u...@host: root[root] @ localhost [] # Query_time: 649 Lock_time: 0 Rows_sent: 0 Rows_examined: 26758561 use world; create table rmpdata1 select

Re: How to optimize a slow query?

2009-09-05 Thread mos
How many rows were added to rmpdata1 table? If it is 13.4 million rows then it is going to take several minutes to join this many rows from the 2 tables. Is there a 1:1 relationship between the two tables or a 1:Many? If there is a 1:1 then I'd recommend joining the two tables into 1 table so

Re: How to Optimize distinct with index

2009-06-26 Thread Moon's Father
temporary table howevery I have thousands of queries per second. How to optimize it? Anthoer question: Select * from user where user_id in(id1,id2,id3,id4,.) order by use_id; I add index on user_id,but after in,order use temporary table, How to optimize it? Thanks

Re: How to Optimize distinct with index

2009-06-19 Thread Dan Nelson
; I add index on (key1,key2,key3,user_id), this sql use temporary table however. I have thousands of queries per second. How to optimize it? Because of the distinct clause, mysql has to remember all of the user_id values during the query so it can remove duplicates. You do have an index

Re: How to Optimize distinct with index

2009-06-19 Thread Darryle Steplight
user_id from user where key1=value and key2=value2 and key3=value2; I add index on (key1,key2,key3,user_id), this sql use temporary table howevery I have thousands of queries per second. How to optimize it? Anthoer question: Select * from user where user_id in(id1,id2,id3,id4,.) order

How to Optimize distinct with index

2009-06-18 Thread 周彦伟
Hi, I have a sql : Select distinct user_id from user where key1=value and key2=value2 and key3=value2; I add index on (key1,key2,key3,user_id), this sql use temporary table howevery I have thousands of queries per second. How to optimize it? Anthoer question: Select

how to optimize: max(timetstamp) where a.foo=b.foo ?

2008-07-24 Thread walter harms
hi list, i have tables that look like this( 10.000 entries) : id, timestamp, value to get the latest value for each id i have queries like: select * from tab A where timestamp = (select max(timestamp) from tab B where B.id=A.id) group by id ; on a fast system it takes round 4 sec to complet,

Re: how to optimize: max(timetstamp) where a.foo=b.foo ?

2008-07-24 Thread Mr. Shawn H. Corey
On Thu, 2008-07-24 at 14:49 +0200, walter harms wrote: hi list, i have tables that look like this( 10.000 entries) : id, timestamp, value to get the latest value for each id i have queries like: select * from tab A where timestamp = (select max(timestamp) from tab B where

Re: how to optimize: max(timetstamp) where a.foo=b.foo ?

2008-07-24 Thread Peter Brawley
to get the latest value for each id i have queries like: select * from tab A where timestamp = (select max(timestamp) from tab B where B.id=A.id) group by id ; See Within-group aggregates at http://www.artfulsoftware.com/infotree/queries.php. PB walter harms wrote: hi list, i have

Re: how to optimize: max(timetstamp) where a.foo=b.foo ?

2008-07-24 Thread walter harms
Peter Brawley wrote: to get the latest value for each id i have queries like: select * from tab A where timestamp = (select max(timestamp) from tab B where B.id=A.id) group by id ; See Within-group aggregates at http://www.artfulsoftware.com/infotree/queries.php. PB hi peter, txh

Re: How to optimize this long query

2007-06-28 Thread Andrew Hutchings
Kwang Chin Lee wrote: Hello, I have several tables storing item information, keyword (mainly for searching), category and subcategory (also for searching). The query I am using now is: SELECT i.*, it.*, ic.*, c.*, cs.*, s.*, st.* FROM item i LEFT JOIN iteminfo it ON i.id = it.id

How to optimize this long query

2007-06-21 Thread Kwang Chin Lee
Hello, I have several tables storing item information, keyword (mainly for searching), category and subcategory (also for searching). The query I am using now is: SELECT i.*, it.*, ic.*, c.*, cs.*, s.*, st.* FROM item i LEFT JOIN iteminfo it ON i.id = it.id LEFT JOIN itemkeyword ik ON i.id

Re: How to optimize this long query

2007-06-21 Thread Philip Hallstrom
Hello, I have several tables storing item information, keyword (mainly for searching), category and subcategory (also for searching). The query I am using now is: SELECT i.*, it.*, ic.*, c.*, cs.*, s.*, st.* FROM item i LEFT JOIN iteminfo it ON i.id = it.id LEFT JOIN itemkeyword ik ON i.id =

how to optimize this simple query with join?

2007-03-03 Thread MAS!
I have to tables (on mysql 5.0.22): Table: shelf CREATE TABLE `shelf` ( `isbn` varchar(10) NOT NULL default '', `product_type` char(1) default NULL, `title` varchar(150) NOT NULL default '', (...) PRIMARY KEY (`isbn`), KEY `publ_date` (`publ_date`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1

Re: How to optimize fulltext selection?

2005-09-06 Thread Michael Monashev
Hello Thank you so much. I Just increase the size of some buffers: # The MySQL server [mysqld] default-character-set = cp1251 port= 3306 socket = /x/xx.sock basedir = /x datadir = /x/x log-error = /x/error.log log-slow-queries = /x/slow.log

Re: How to optimize fulltext selection?

2005-09-05 Thread Gleb Paharenko
Hello. At first, we should ensure that most time query is spending in the ordering of the results. What state is SHOW PROCESSLIST reporting for this query? Michael Monashev [EMAIL PROTECTED] wrote: Hello GP And MySQL uses a filesort algorithm. How to make the filesort

Re: How to optimize fulltext selection?

2005-09-05 Thread Michael Monashev
Hello GP What state is SHOW PROCESSLIST reporting for this query? Fulltext initialization Sincerely, Michael, http://xoib.com/ http://3d2f.com/ http://qaix.com/ http://ryxi.com/ http://gyxe.com/ http://gyxu.com/ http://xywe.com/ http://xyqe.com/ -- MySQL General Mailing List For

Re: How to optimize fulltext selection?

2005-09-05 Thread Gleb Paharenko
Hello. Fulltext initialization Ok, now we exactly know that we should optimize the FULLTEXT part of your query. I don't know the options which directly affects the speed of the FULLTEXT searches, so I suggest you to play with key_buffer and table structure. The ratio of Key_reads to

Re: How to optimize fulltext selection?

2005-09-04 Thread Michael Monashev
Hello GP And MySQL uses a filesort algorithm. How to make the filesort faster? May be I have to increase size of some buffers? Sincerely, Michael, http://xoib.com/ http://3d2f.com/ http://qaix.com/ http://ryxi.com/ http://gyxe.com/ http://gyxu.com/ http://xywe.com/ http://xyqe.com/ --

Re: How to optimize fulltext selection?

2005-09-03 Thread Gleb Paharenko
Privet. SELECT SQL_CACHE id, program_name, categor, subcategor, subsubcategor, subsubsubcategor, source_url, rating, short_description, long_description, when_modifed+0, author, searched_words, size_in_kb, licence, language, install, win95, win98, winme, winnt, win2000, winxp, wince,

Re: How to optimize fulltext selection?

2005-09-02 Thread Gleb Paharenko
Privet! Send to the list the output of 'SHOW VARIABLES' and 'SHOW STATUS' statements, amount of RAM, most problematic queries (use mysqldumpslow utility to find them) include tables' definitions (use SHOW CREATE TABLE). Michael Monashev [EMAIL PROTECTED] wrote: Hello, I have

Re: How to optimize fulltext selection?

2005-09-02 Thread Michael Monashev
Hello GP Send to the list the output of 'SHOW VARIABLES' and 'SHOW STATUS' GP statements, amount of RAM, most problematic queries (use mysqldumpslow GP utility to find them) include tables' definitions (use SHOW CREATE GP TABLE). SHOW VARIABLES; back_log50 basedir /*/

How to optimize fulltext selection?

2005-09-01 Thread Michael Monashev
Hello, I have 200-300 kb slow log daily with fulltext queries only :-( All queries using fulltext indexes. I use huge mysql cofig (huge.cfg). What can I change in the mysql configuration for better performance? Sincerely, Michael, http://xoib.com/ http://3d2f.com/ http://qaix.com/

Re: how to optimize this query

2005-05-27 Thread Kevin Weslowski
Well, it seems you've helped solve my problem, Shawn...here we go: first off, sorry about the text wrapping and the sloppy sql...I do get lazy sometimes...I am a programmer :P you asked how fast this runs: SELECT ind_first_name , ind_last_name , fam_phone ,

Re: how to optimize this query

2005-05-27 Thread SGreen
Kevin Weslowski [EMAIL PROTECTED] wrote on 05/26/2005 02:20:46 AM: Hi, I've got a query that I believe should be giving me better performance than it is, since I've put indexes on all the appropriate columns...I'll include as much info as I can for anyone wishing to help me optimize the

how to optimize this query

2005-05-26 Thread Kevin Weslowski
Hi, I've got a query that I believe should be giving me better performance than it is, since I've put indexes on all the appropriate columns...I'll include as much info as I can for anyone wishing to help me optimize the query/tables/indicies...thanks in advance for any assistance... the

how to optimize multiple many-to-many relationship related query

2004-10-18 Thread Elim Qiu
I have, to make it clear, 2 many-to-many relationships for table person: PersonPerson_Club ClubPerson_Creditcard CreditCard ----- - -

Re: How to optimize ugly order by?

2004-03-25 Thread Don Read
On 24-Mar-2004 Henrik Schröder wrote: snip No, I did not choose the sort order. No, I can not change the values used. Yes, it has to be this sort order. :-) Best would be to use ENUM( '1','2','0') ... But otherwise -- (membershiptype % 2) DESC, membershiptype DESC -- or --

How to optimize ugly order by?

2004-03-24 Thread Henrik Schröder
Hi all, I have a table of users which contains a lot of information, and also a column called membershiptype which can either be 0, 1, or 2. This table is used a lot in various searches, and all results should be ordered by membership type, but the order should not be 0-1-2, but instead 1-2-0.

Re: How to optimize ugly order by?

2004-03-24 Thread Victor Pendleton
Does the where clause contain the order by columns? If not, then you will have a filesort no matter what. On Wed, 24 Mar 2004, Henrik Schröder wrote: Hi all, I have a table of users which contains a lot of information, and also a column called membershiptype which can either be 0, 1, or 2.

Re: How to optimize ugly order by?

2004-03-24 Thread Jigal van Hemert
From: Henrik Schröder [EMAIL PROTECTED] used a lot in various searches, and all results should be ordered by membership type, but the order should not be 0-1-2, but instead 1-2-0. One thing you could do (not very neat IMHO) is to JOIN this query with a table that contains membershiptype and a

Re: How to optimize ugly order by?

2004-03-24 Thread Victor Pendleton
Let me rephrase my statement. Does the index being used include the order by columns? If not, the optimizer will not be able to perform both row selection and row ordering in the same pass. On Wed, 24 Mar 2004, Victor Pendleton wrote: Does the where clause contain the order by columns? If not,

Re: How to optimize ugly order by?

2004-03-24 Thread Tim McDonough
On Wed, 24 Mar 2004 15:47:46 +0100, Henrik Schröder wrote: I have a table of users which contains a lot of information, and also a column called membershiptype which can either be 0, 1, or 2. This table is used a lot in various searches, and all results should be ordered by membership type,

RE: How to optimize ugly order by?

2004-03-24 Thread Henrik Schröder
- From: Victor Pendleton [mailto:[EMAIL PROTECTED] Sent: den 24 mars 2004 16:22 To: [EMAIL PROTECTED]; Henrik Schröder; '[EMAIL PROTECTED]' Subject: Re: How to optimize ugly order by? Let me rephrase my statement. Does the index being used include the order by columns? If not, the optimizer

RE: How to optimize ugly order by?

2004-03-24 Thread Henrik Schröder
Hemert [mailto:[EMAIL PROTECTED] Sent: den 24 mars 2004 16:12 To: [EMAIL PROTECTED] Subject: Re: How to optimize ugly order by? From: Henrik Schröder [EMAIL PROTECTED] used a lot in various searches, and all results should be ordered by membership type, but the order should not be 0-1-2

RE: How to optimize ugly order by?

2004-03-24 Thread Victor Pendleton
the biggest problem, right? /Henrik -Original Message- From: Victor Pendleton [mailto:[EMAIL PROTECTED] Sent: den 24 mars 2004 16:22 To: [EMAIL PROTECTED]; Henrik Schröder; '[EMAIL PROTECTED]' Subject: Re: How to optimize ugly order by? Let me rephrase my statement. Does

Re: How to optimize ugly order by?

2004-03-24 Thread Brent Baisley
I assume you are just trying to make things more readable. As far as I know, MySQL does not support custom sort orders, except when a field is an enum or a set. Even then, that's not a custom order since your still sorting on the underlying values. You could do something like this for

Re: How to optimize ugly order by?

2004-03-24 Thread Michael Stassen
Henrik Schröder wrote: Hi all, I have a table of users which contains a lot of information, and also a column called membershiptype which can either be 0, 1, or 2. This table is used a lot in various searches, and all results should be ordered by membership type, but the order should not be

Re: How to optimize ugly order by?

2004-03-24 Thread Dave Dash
Can you do: SELECT IF(membershiptype = 0, 3, membershiptype) AS s1 FROM... ORDER BY s1 Shouldn't that work? Basically if mtype is 0 return 3 otherwise return the membership type... and sort by that field. lemme know if that works or if I'm dead wrong ;) Henrik Schröder wrote: Hi all,

How to optimize this query?

2003-12-19 Thread Adam Clauss
I have a table which contains many items. Each item consists of an scriptID, several attributes, and an optional field - a parent (called dupeitem in the database) item. Most all of these fields are strings - even the IDs which consist of a combination of letters and numbers. Items which have a

Re: How to optimize/index merged tables

2002-07-23 Thread Benjamin Pflugmann
Hi. On Mon 2002-07-08 at 17:49:03 -0700, [EMAIL PROTECTED] wrote: Hello, I have _a lot_ of http log data to throw into a mysql db (currently over 1.5 billion rows). New data is coming in all the time, so I don't want to lock myself into one set of big tables that are over 100 gigs each.

How to optimize/index merged tables

2002-07-08 Thread Brad Ford
Hello, I have _a lot_ of http log data to throw into a mysql db (currently over 1.5 billion rows). New data is coming in all the time, so I don't want to lock myself into one set of big tables that are over 100 gigs each. I'd rather arrange this data into smaller chunks, then merge the tables

Join takes way too long. How to optimize this smal query?

2002-05-20 Thread andy
Hi there, after reading a nice articel on normalisation, I did split my tables and now I am suffering performance lost. this query (finding out the amount of user which have posted an article on germany) takes 4.5 s: SELECT count(DISTINCT user_recommending) FROM recommendations t INNER JOIN

Re: Join takes way too long. How to optimize this smal query?

2002-05-20 Thread Gelu Gogancea
[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 20, 2002 1:48 PM Subject: Join takes way too long. How to optimize this smal query? Hi there, after reading a nice articel on normalisation, I did split my tables and now I am suffering performance lost. this query (finding out

Re: How to optimize this sql ?

2002-04-27 Thread Benjamin Pflugmann
Hello. On Thu, Apr 25, 2002 at 01:49:39PM +0200, [EMAIL PROTECTED] wrote: [...] mysql show index from cpu; +---++--+--+-+---+-+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name |

How to optimize this sql ?

2002-04-25 Thread nemholt_jf
Hi! I have this table : mysql desc cpu; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra |

How to optimize this

2001-12-28 Thread Goran Krajacic
How to optimize this query: SELECT col1, col2, MAX(col3) FROM Table WHERE col42 AND col5 = 2 GROUP BY col3 LIMIT 1; The best that i figured out is to set the index on col3. I was unable to find out the working combination for multi-column indexing. Please advice

Re: How to optimize this

2001-12-28 Thread Dan Nelson
In the last episode (Dec 28), Goran Krajacic said: How to optimize this query: SELECT col1, col2, MAX(col3) FROM Table WHERE col42 AND col5 = 2 GROUP BY col3 LIMIT 1; Try a compound index on (col5,col4), or if you really want speed, (col5,col4,col3,col2,col1), which will let mysql use

to many connections, how to optimize them?

2001-11-30 Thread Jerry
Hi! I have a problem! Too many connections error in myODBC. I am wondering now how to optimize the code... What is better, to make 14 open.comm and close.conn on a web page or to open once and close once? Asked differently, is it better to connect to database one and be connected until all

Re: to many connections, how to optimize them?

2001-11-30 Thread sherzodR
Every connection will carry some overhead cost. So you'll have to connect as few times as possible. Jerry wrote: J: Hi! J: J: I have a problem! Too many connections error in myODBC. J: J: I am wondering now how to optimize the code... J: J: What is better, to make

how to optimize for large databases

2001-02-24 Thread ryc
First let me explain what I am trying to do. I want to archive many many messages into a mysql database. The format is pretty simple... either the message is a parent, or it is a reply. The problem is that some of the queries are taking 5-10 seconds, which is not acceptable for my application.