in mysql sub queries dont perform well.

You can could try this

SELECT a.ID
FROM ven_tes a, ven_tes b where a.id=b.id and b.id_ven=6573 .






On 5/20/08, Wakan <[EMAIL PROTECTED]> wrote:
>
> Hi,
> can someone could explain where are problems in this query:
>
> EXPLAIN
> SELECT ID
> FROM ven_tes
> WHERE ID IN (SELECT ID FROM ven_tes WHERE ID_ven=6573)
> +----+--------------------+---------+-----------------+----------------+---------+---------+------+------+--------------------------+
>
>
> | id | select_type        | table   | type            | possible_keys  |
> key     | key_len | ref  | rows | Extra                    |
> +----+--------------------+---------+-----------------+----------------+---------+---------+------+------+--------------------------+
>
>
> |  1 | PRIMARY            | ven_tes | index           | NULL           |
> PRIMARY |       4 | NULL | 6573 | Using where; Using index |
> |  2 | DEPENDENT SUBQUERY | ven_tes | unique_subquery | PRIMARY,ID_ven |
> PRIMARY |       4 | func |    1 | Using index; Using where |
> +----+--------------------+---------+-----------------+----------------+---------+---------+------+------+--------------------------+
>
>
> as you can see, it doesn't use absolutely indexes on ven_tes (ID is the
> primary key, ID_ven is index)
>
> Thanks in advance
> Carlo
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

Reply via email to