From: Jorgen Loland Date: January 14 2011 12:22pm Subject: Re: bzr commit into mysql-next-mr-bugfixing branch (jorgen.loland:3248) WL#5741 List-Archive: http://lists.mysql.com/commits/128733 Message-Id: <4D304018.2080207@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit On 01/11/2011 02:44 PM, Guilhem Bichot wrote: > Hello again, > > This is fine, I just have curiosity questions: > > Jorgen Loland a écrit, Le 11.01.2011 12:56: >> + "records_estimation": [ >> + { >> + "database": "test", >> + "table": "t2", >> + "records": 1, > > Do you know why it says there is 1 record, though the table is empty? The code doesn't check how many rows there are, but the fact that it has type system or const: if (s->type == JT_SYSTEM || s->type == JT_CONST) { trace_table.add("records", 1).add("cost", 1); trace_table.add_alnum("table_type", (s->type == JT_SYSTEM) ? "system": "const"); /* Only one matching row */ s->found_records= s->records= s->read_time=1; s->worst_seeks= 1.0; continue; } >> + ] /* evaluate_subselect_cond_steps */, >> + "after_equality_propagation": "((NULL <> (/* select#3 */ select >> `test`.`t2`.`a` from `test`.`t2` limit 1)) and multiple equal((/* >> select#2 */ select NULL from `test`.`t2` limit 1), `test`.`t1`.`a`))", > > I don't understand how we come to this new condition above, from > "original_condition": > * "NULL <> (select #3 etc)" > makes me think that t1.a was replaced by NULL (but why: t1 is empty?). > * in multiple equal((/* select#2 */ select NULL from `test`.`t2` limit > 1), `test`.`t1`.`a`) t1.a was not replaced, and also t2.b was replaced > by NULL (which may be ok if the system noted that t2 is empty and thus > the subquery will return NULL, but then why didn't it replace the entire > subquery with NULL?). > This is not related to your patch, so if you don't know, I can research > it myself. I have no idea. -- Jørgen Løland | Senior Software Engineer | +47 73842138 Oracle MySQL Trondheim, Norway