Re: explain shows type = ALL for indexed column

2010-12-22 Thread 杨涛涛
Yeah. The subquery sometimes creates temporary tables, so the performance is worse than join. Just leaving it. David Yeung, In China, Beijing. My First Blog:http://yueliangdao0608.cublog.cn My Second Blog:http://yueliangdao0608.blog.51cto.com My Msn: yueliangdao0...@gmail.com 2010/12/8 Aaron Tur

Re: explain shows type = ALL for indexed column

2010-12-07 Thread Aaron Turner
Thanks Gavin. Rewriting the query to not use the subselect solved the problem! On Tue, Dec 7, 2010 at 11:33 AM, Gavin Towey wrote: > Mysql often handles subqueries poorly.  It's best to rewrite that as a JOIN > instead: > > http://dev.mysql.com/doc/refman/5.1/en/rewriting-subqueries.html > > If

RE: explain shows type = ALL for indexed column

2010-12-07 Thread Gavin Towey
Mysql often handles subqueries poorly. It's best to rewrite that as a JOIN instead: http://dev.mysql.com/doc/refman/5.1/en/rewriting-subqueries.html If you have further questions after doing that, show the table structures, the query, and the explain output. -Original Message- From: A

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-25 Thread Baron Schwartz
Hello, On Wed, Feb 24, 2010 at 10:11 AM, Yang Zhang wrote: > I have the following query. Note that the nested query has no > dependencies on the outer one, yet mysql reports it as dependent. Do an EXPLAIN EXTENDED followed by SHOW WARNINGS. You will see the "optimization" that mysqld applies to

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-25 Thread Perrin Harkins
On Thu, Feb 25, 2010 at 2:48 AM, Dan Nelson wrote: > IN is fine ( for example ... WHERE field1 IN (1,2,3,4,5,6) is extremely > efficient); Yes, I meant to say IN/NOT IN subqueries, not value lists. > it's subqueries in general that are killers. Subqueries in the FROM clause (aka derived tables)

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-25 Thread Johan De Meersman
On Thu, Feb 25, 2010 at 8:48 AM, Dan Nelson wrote: > IN is fine ( for example ... WHERE field1 IN (1,2,3,4,5,6) is extremely > efficient); it's subqueries in general that are killers. > If the dependent subquery is nothing but index lookups, it's still blazingly fast, though :) I just optimized

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-24 Thread Dan Nelson
In the last episode (Feb 24), Perrin Harkins said: > On Wed, Feb 24, 2010 at 10:11 AM, Yang Zhang wrote: > > Any ideas on how to optimize this by convincing mysql to see the > > independence use a const join? > > http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-24 Thread Perrin Harkins
On Wed, Feb 24, 2010 at 10:11 AM, Yang Zhang wrote: > Any ideas on > how to optimize this by convincing mysql to see the independence use a > const join? http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/ You need to rewrite as a join or use a FROM subquery. You

Re: explain

2007-06-06 Thread Baron Schwartz
Hola Ricardo, Ricardo Conrado Serafim wrote: Hi group, Someone can answer me if when I execute the "explain" in a select statement, the select is executed to get the parameters or this information came from other place? In other words, the explain covers the table and indexes or it calculate

Re: explain not explaining long running query?

2005-08-09 Thread Gleb Paharenko
Hello. > State: Sending data MySQL server shouldn't spend several days in state of sending one row (your query should return only one row :) to the client. Server doesn't work properly and steps like upgrade or switching to the official binaries might be helpful. > > The query h

Re: explain not explaining long running query?

2005-08-08 Thread SGreen
David Sparks <[EMAIL PROTECTED]> wrote on 08/08/2005 12:20:41 PM: > Hi all! > > Gleb Paharenko wrote: > > Hello. > > > > > > > >>I have a query that is taking days to complete (not good). If I change > > > > > > Really, not good. What does SHOW PROCESSLIST report about the thread of > >

Re: explain not explaining long running query?

2005-08-08 Thread David Sparks
Hi all! Gleb Paharenko wrote: > Hello. > > > >>I have a query that is taking days to complete (not good). If I change > > > Really, not good. What does SHOW PROCESSLIST report about the thread of > this query? The query has been running for ~5 days now: Id: 27977 User: root Ho

Re: explain not explaining long running query?

2005-08-05 Thread Jason Pyeron
On Fri, 5 Aug 2005, Joerg Bruehe wrote: Hi Shawn, all! Still, I would consider to replace X > A AND X < B by X BETWEEN (A+1) AND (B-1) for the reasons I gave in my original post (provided we talk about integral values). the field is a DOUBLE, so you can't could this also explain why

Re: explain not explaining long running query?

2005-08-05 Thread Joerg Bruehe
Hi Shawn, all! [EMAIL PROTECTED] wrote: Joerg Bruehe <[EMAIL PROTECTED]> wrote on 08/05/2005 02:08:35 PM: [[...]] Have you considered using BETWEEN? [[...]] Actually, no, he cannot substitute BETWEEN as BETWEEN is _inclusive_ of the boundary conditions (a closed interval). In this case he

Re: explain not explaining long running query?

2005-08-05 Thread SGreen
Joerg Bruehe <[EMAIL PROTECTED]> wrote on 08/05/2005 02:08:35 PM: > Hi David, all! > > David Sparks wrote: > > I have a query that is taking days to complete (not good). If I change > > the query so that it selects less rows it runs fast. > > I fear I have no decisive hint for this (sorry), bu

Re: explain not explaining long running query?

2005-08-05 Thread Joerg Bruehe
Hi David, all! David Sparks wrote: I have a query that is taking days to complete (not good). If I change the query so that it selects less rows it runs fast. I fear I have no decisive hint for this (sorry), but still ... [[...]] mysql> select count(*) from msgs where message_id > 112

Re: explain not explaining long running query?

2005-08-05 Thread Gleb Paharenko
Hello. > I have a query that is taking days to complete (not good). If I change Really, not good. What does SHOW PROCESSLIST report about the thread of this query? David Sparks <[EMAIL PROTECTED]> wrote: > I have a query that is taking days to complete (not good). If I change

Re: Explain and indexes

2005-03-09 Thread Jigal van Hemert
From: "Terry Spencer" > An index exists on all three columns referred to, in addition to a > combination of del and signoff. > > The indexes are listed as possible keys, but none used by the query; key = > null. Can anyone suggest why? How can I optimise this? How many records are there in the tab

Re: EXPLAIN does not explain the WHERE clause

2005-03-01 Thread gerald_clark
Christopher Malton wrote: When I use the statement: EXPLAIN SELECT * FROM workunits WHERE Sent>0 It returns +---+--+---++-++-++ | table | type | possible_keys | key| key_len | ref| rows| Extra | +---

Re: EXPLAIN: Select tables optimized away

2005-02-17 Thread Gabriel PREDA
"O'K Web Design" <[EMAIL PROTECTED]> Subject: Re: EXPLAIN: Select tables optimized away > Hi > > Counts are extremely fast and since you have no WHERE statement, it > takes the count value straight from the internals and does not look at the > tables or an inde

Re: EXPLAIN: Select tables optimized away

2005-02-17 Thread O'K Web Design
Hi Counts are extremely fast and since you have no WHERE statement, it takes the count value straight from the internals and does not look at the tables or an index if I remember correctly. Mike - Original Message - From: "Gabriel PREDA" <[EMAIL PROTECTED]> To: Sent: February 17,

RE: EXPLAIN: Select tables optimized away

2005-02-17 Thread Andy Eastham
Gabriel, I think it means that this count can be done from an index, so there's no need to access the actual table at all. Andy > -Original Message- > From: Gabriel PREDA [mailto:[EMAIL PROTECTED] > Sent: 17 February 2005 11:16 > To: mysql@lists.mysql.com > Subject: EXPLAIN: Select table

Re: "explain" tree like structure? Code available? Examples?

2004-03-03 Thread Martijn Tonies
Hi Chris, > Hmm > > The question is, does MySQL's optimiser do enough planing to result in a > tree of any non-trivial interest? I don't know - apparently, you think it doesn't? > I love MySQL as much as the next geek with a significant other that > loves dolphins, but I'm not sure that MySQ

Re: "explain" tree like structure? Code available? Examples?

2004-03-02 Thread Chris Nolan
Hmm The question is, does MySQL's optimiser do enough planing to result in a tree of any non-trivial interest? I love MySQL as much as the next geek with a significant other that loves dolphins, but I'm not sure that MySQL 4.0 would provide a lot of data for funky tree-drawing (MS SQL tool

Re: explain

2003-09-21 Thread Jeremy Zawodny
On Fri, Sep 19, 2003 at 10:20:34PM -0700, Hsiu-Hui Tseng wrote: > These 2 are the queries > > explain select * from user where user_id = 123; > -> where user_id is the primary key of user table with 2178576 rows. Is there a user with user_id 123? -- Jeremy D. Zawodny | Perl, Web, MySQL, L

RE: explain

2003-09-19 Thread Hsiu-Hui Tseng
513726 rows. -Original Message- From: Jeremy Zawodny [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 3:13 PM To: Hsiu-Hui Tseng Cc: [EMAIL PROTECTED] Subject: Re: explain On Fri, Sep 19, 2003 at 02:12:02PM -0700, Hsiu-Hui Tseng wrote: > Hello, > > When I do a explain on

Re: explain

2003-09-19 Thread Matt W
Hi, - Original Message - From: "Jeremy Zawodny" Cc: <[EMAIL PROTECTED]> Sent: Friday, September 19, 2003 5:12 PM Subject: Re: explain > On Fri, Sep 19, 2003 at 02:12:02PM -0700, Hsiu-Hui Tseng wrote: > > Hello, > > > > When I do a ex

Re: explain

2003-09-19 Thread Jeremy Zawodny
On Fri, Sep 19, 2003 at 02:12:02PM -0700, Hsiu-Hui Tseng wrote: > Hello, > > When I do a explain on a query, I got the following: > +-+ > | Comment | > +-

RE: explain

2003-09-19 Thread Dathan Vance Pattishall
No that says that it can figure out the where and prob wont use a key. The like is probably the cause. If it was going to use the primary key then the FIELD Key_used (something like that) would say PRIMARY. - Dathan Vance Pattishall   - Sr. Programmer and mySQL DBA for FriendFinder Inc.   - http:

re: explain bug?

2002-11-04 Thread Egor Egorov
Robert, Monday, November 04, 2002, 12:39:34 AM, you wrote: RGp> I've tried an EXPLAIN of the SELECT below. RGp> Please can anyone tell me why it's RGp> "Impossible WHERE noticed after reading const tables" RGp> ? RGp> I've droped and created the table - but the error/message occurs. RGp> When I

Re: EXPLAIN feature request

2002-03-20 Thread Sinisa Milivojevic
Ken Menzel writes: > Hi Guys, >I would like to request an additional feature with EXPLAIN. > EXPLAIN does not run the query guesses on how the query would be run. > This is not always accurate. The slow-log however logs the actual > information the query was run with (like explain only the tru

Re: Explain this Explain ?

2002-02-18 Thread Cary
At 04:09 PM 2/18/02, Chris Boget wrote: > > I couldn't find anything like this in my MySQL book or in the on line help. > >Could this be what you are looking for? > >http://www.mysql.com/doc/E/X/EXPLAIN.html > >Not sure exactly what you need to know... > >Chris Sorry if I wasn't clear. I've read

Re: Explain this Explain ?

2002-02-18 Thread Chris Boget
> I couldn't find anything like this in my MySQL book or in the on line help. Could this be what you are looking for? http://www.mysql.com/doc/E/X/EXPLAIN.html Not sure exactly what you need to know... Chris - Before posting

Re: explain table within perl DBI

2002-02-14 Thread Paul DuBois
At 15:51 -0800 2/14/02, Brian Warn wrote: >When I run the code below, information about the first column in each >table in my list is excluded. Any ideas why? Why are you reading a row into @row_ary? I bet you're thinking that row will correspond to the row of column headers that you'd see wer

Re: explain table within perl DBI

2002-02-14 Thread Keith C. Ivey
On 14 Feb 2002, at 15:51, Brian Warn wrote: > When I run the code below, information about the first column in each > table in my list is excluded. Any ideas why? [snip] > @row_ary = $sth->fetchrow_array; You've read that information into @row_ary, but then you never do anything with it

Re: EXPLAIN question

2001-07-20 Thread Dan Nelson
In the last episode (Jul 20), Ravi Raman said: > ok, first actual question to the list, hope someone can help: > the following query - > > select pn.number, c.ID, c.cost, c.days_valid, c.description from > pinnumbers pn, cardtype c where pn.cardtypeID = c.ID and pn.tmaster = 0 > order by c.ID, pn.

Re: EXPLAIN with unexpected result.

2001-02-28 Thread Simon Windsor
Hi Two points: - Any multi column index a,b,c also indexes a and a,b - In using an index, efficiency is important, and if you have two indexes a,b,c and a,d,b , when you hit data from columns a+b+d, the database engine has to work out if accessing the data from a+b is more efficient than

Re: "explain select" question

2001-01-22 Thread Tõnu Samuel
Dimitar Boiadjiev wrote: > > Hi all, > I've been working on optimizing my query but no success. Concerning the > type of query shown by "explain select", about join type "ALL" in the > manual is written: "This is normally not good if the table is the first > table not marked const, and usually ve