18 lines
376 B
MySQL
18 lines
376 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`visible_clean`()
|
||
|
BEGIN
|
||
|
DROP TEMPORARY TABLE IF EXISTS tCalc;
|
||
|
CREATE TEMPORARY TABLE tCalc
|
||
|
(INDEX (id))
|
||
|
ENGINE = MEMORY
|
||
|
SELECT id FROM cache_calc;
|
||
|
|
||
|
DELETE v
|
||
|
FROM visible v
|
||
|
LEFT JOIN tCalc c ON c.id = v.calc_id
|
||
|
WHERE c.id IS NULL;
|
||
|
|
||
|
DROP TEMPORARY TABLE tCalc;
|
||
|
END$$
|
||
|
DELIMITER ;
|