Below is the list of changes that have just been committed into a local
5.0 repository of patg. When patg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1908 05/05/27 22:07:46 patg@stripped +3 -0
Comment and test changes per review request by Timour. All tests pass on production with
this code.
sql/ha_federated.cc
1.27 05/05/27 22:07:36 patg@stripped +5 -1
better comment to explain why we need table->status set to 0
mysql-test/t/federated.test
1.10 05/05/27 22:07:36 patg@stripped +31 -0
Added explain to test per Timour's request
mysql-test/r/federated.result
1.12 05/05/27 22:07:35 patg@stripped +43 -0
added explain results to join test results per Timour's request.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: patg
# Host: radha.local
# Root: /Users/patg/mysql-5.0
--- 1.11/mysql-test/r/federated.result Wed May 25 02:12:40 2005
+++ 1.12/mysql-test/r/federated.result Fri May 27 22:07:35 2005
@@ -906,6 +906,13 @@
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1, federated.countries WHERE
@@ -916,6 +923,13 @@
Marizio 3 33333 Italy
Monty 4 33333 Finland
Sanja 5 33333 Ukraine
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
@@ -926,6 +940,14 @@
Marizio 3 33333 Italy
Monty 4 33333 Finland
Sanja 5 33333 Ukraine
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 Using where
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
@@ -933,6 +955,13 @@
WHERE federated.t1.name = 'Monty';
name country_id other country
Monty 4 33333 Finland
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 LEFT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
@@ -943,6 +972,13 @@
3 3 Marizio 33333 Italy
4 4 Monty 33333 Finland
5 5 Sanja 33333 Ukraine
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 LEFT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
@@ -953,6 +989,13 @@
1 1 Kumar 11111 India
3 3 Marizio 33333 Italy
5 5 Sanja 33333 Ukraine
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 RIGHT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
--- 1.9/mysql-test/t/federated.test Wed May 25 02:12:40 2005
+++ 1.10/mysql-test/t/federated.test Fri May 27 22:07:36 2005
@@ -862,16 +862,32 @@
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
#inner join
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1, federated.countries WHERE
federated.t1.country_id = federated.countries.id;
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
federated.t1.country_id = federated.countries.id;
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
@@ -879,17 +895,32 @@
WHERE federated.t1.name = 'Monty';
#left join
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 LEFT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
ORDER BY federated.countries.id;
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 LEFT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
ORDER BY federated.countries.country;
#right join
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
+
SELECT federated.t1.*, federated.countries.country
FROM federated.t1 RIGHT JOIN federated.countries
ON federated.t1.country_id = federated.countries.id
--- 1.26/sql/ha_federated.cc Wed May 25 02:12:40 2005
+++ 1.27/sql/ha_federated.cc Fri May 27 22:07:36 2005
@@ -1526,7 +1526,11 @@
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(mysql_errno(mysql));
}
- /* very important - joins will not work without this! */
+ /*
+ This basically says that the record in table->record[0] is legal, and that it is
+ ok to use this record, for whatever reason, such as with a join (without it, joins
+ will not work)
+ */
table->status=0;
DBUG_RETURN(rnd_next(buf));
| Thread |
|---|
| • bk commit into 5.0 tree (patg:1.1908) | Patrick Galbraith | 27 May |