Dear list,
i have some small tables but for some reason the mysql took very long to
find the results. my query looks
like below and mysql'e explain is attached for better format. Thanks for
your help!
select teu.name, eca.owner_id, ece.value
from typed_enterprise_unit teu,
e_contact_association eca,
e_contact_entry ece
where teu.unit_id=eca.owner_id and eca.entry_id=ece.entry_id and
eca.type_id=68 and (teu.type_path like '%/66/%' or teu.type_id=66)
and eca.owner_id > 45
order by eca.owner_id limit 50;
mysql> select teu.name, eca.owner_id, ece.value
->
-> from typed_enterprise_unit teu,
-> e_contact_association eca,
-> e_contact_entry ece
->
-> where teu.unit_id=eca.owner_id and eca.entry_id=ece.entry_id and
-> eca.type_id=68 and (teu.type_path like '%/66/%' or
teu.type_id=66)
->
-> order by eca.owner_id limit 22;
+---------------------------------------------------+----------+--------------------------------+
| name | owner_id | value
|
+---------------------------------------------------+----------+--------------------------------+
| Asian Book One | 45 | [EMAIL
PROTECTED] |
+---------------------------------------------------+----------+--------------------------------+
................................................................................................
22 rows in set (4.97 sec)
mysql> explain select teu.name, eca.owner_id, ece.value
->
-> from typed_enterprise_unit teu,
-> e_contact_association eca,
-> e_contact_entry ece
->
-> where teu.unit_id=eca.owner_id and eca.entry_id=ece.entry_id and
-> eca.type_id=68 and (teu.type_path like '%/66/%' or
teu.type_id=66)
->
-> order by eca.owner_id limit 22;
+----+-------------+------------+------+---------------+------+---------+------+------+-------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref
| rows | Extra |
+----+-------------+------------+------+---------------+------+---------+------+------+-------------------------+
| 1 | PRIMARY | eca | ALL | NULL | NULL | NULL | NULL
| 2712 | Using where; Using temporary; Using filesort |
| 1 | PRIMARY | ece | ALL | NULL | NULL | NULL | NULL
| 2669 | Using where |
| 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL
| 1440 | Using where |
| 2 | DERIVED | tp | ALL | NULL | NULL | NULL | NULL
| 100 | |
| 2 | DERIVED | eu | ALL | NULL | NULL | NULL | NULL
| 1444 | Using where |
+----+-------------+------------+------+---------------+------+---------+------+------+-------------------------+
5 rows in set (0.37 sec)
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.3.1 - Release Date: 11/15/2004
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]