Bug #25271 | Caching JOIN in stored procedure | ||
---|---|---|---|
Submitted: | 25 Dec 2006 15:18 | Modified: | 26 Dec 2006 12:32 |
Reporter: | Develar | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.0.27 | OS: | Windows (Windows XP SP2) |
Assigned to: | CPU Architecture: | Any | |
Tags: | join, stored procedure |
[25 Dec 2006 15:18]
Develar
[26 Dec 2006 12:16]
Valeriy Kravchuk
Thank you for a problem report. Please, send the results of: SHOW VARIABLES LIKE 'query%';
[26 Dec 2006 12:19]
Develar
+------------------------------+----------+ | Variable_name | Value | +------------------------------+----------+ | query_alloc_block_size | 8192 | | query_cache_limit | 1048576 | | query_cache_min_res_unit | 4096 | | query_cache_size | 16777216 | | query_cache_type | ON | | query_cache_wlock_invalidate | OFF | | query_prealloc_size | 8192 | +------------------------------+----------+
[26 Dec 2006 12:32]
Valeriy Kravchuk
Sorry, but I was not able to repeat the behaviour described with latest 5.0.34-BK on Linux: mysql> CREATE PROCEDURE `admin_get_parent_privileges`(IN $parent MEDIUMINT UNSIGNED) -> NOT DETERMINISTIC -> CONTAINS SQL -> SQL SECURITY DEFINER -> COMMENT '' -> BEGIN -> SELECT SQL_NO_CACHE -> 2 * 2, -> users_privileges.*, -> groups_privileges.*, -> RAND() -> FROM tree -> LEFT JOIN users_privileges ON (tree.id = users_privileges.id AND -> users_privileges.`user` = 1) -> LEFT JOIN groups_privileges ON (tree.id = groups_privileges.id AND -> groups_privileges.`group` = 1) -> WHERE tree.id = $parent; -> END; -> // Query OK, 0 rows affected (0.07 sec) mysql> CALL admin_get_parent_privileges(1)// +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+------------------+ | 2 * 2 | id | user | read | edit | delete | grant | id | group | read | edit | delete | grant | RAND() | +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+------------------+ | 4 | NULL | NULL | NULL | NULL | NULL | NULL | 1 | 1 | 1 | 1 | 1 | 1 | 0.93895839428432 | +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+------------------+ 1 row in set (0.01 sec) Query OK, 0 rows affected (0.01 sec) mysql> CALL admin_get_parent_privileges(6)// +-------+------+------+------+------+--------+-------+------+-------+------+---- --+--------+-------+------------------+ | 2 * 2 | id | user | read | edit | delete | grant | id | group | read | edi t | delete | grant | RAND() | +-------+------+------+------+------+--------+-------+------+-------+------+---- --+--------+-------+------------------+ | 4 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NUL L | NULL | NULL | 0.76751278505429 | +-------+------+------+------+------+--------+-------+------+-------+------+---- --+--------+-------+------------------+ 1 row in set (0.01 sec) Query OK, 0 rows affected (0.01 sec) mysql> CALL admin_get_parent_privileges(1)// +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+-------------------+ | 2 * 2 | id | user | read | edit | delete | grant | id | group | read | edit | delete | grant | RAND() | +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+-------------------+ | 4 | NULL | NULL | NULL | NULL | NULL | NULL | 1 | 1 | 1 | 1 | 1 | 1 | 0.020688773152129 | +-------+------+------+------+------+--------+-------+----+-------+------+------ +--------+-------+-------------------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec) mysql> show variables like 'query%'// +------------------------------+----------+ | Variable_name | Value | +------------------------------+----------+ | query_alloc_block_size | 8192 | | query_cache_limit | 1048576 | | query_cache_min_res_unit | 4096 | | query_cache_size | 16777216 | | query_cache_type | ON | | query_cache_wlock_invalidate | OFF | | query_prealloc_size | 8192 | +------------------------------+----------+ 7 rows in set (0.01 sec) mysql> select version()// +--------------+ | version() | +--------------+ | 5.0.34-debug | +--------------+ 1 row in set (0.00 sec) So, looks like problem is fixed in current sources.