SET @test_start_time = NOW(3) + 0;
SET optimizer_search_depth = 62;

SELECT SQL_NO_CACHE COUNT(*) FROM table_parent AS p WHERE 1
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 1 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 2 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 3 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 4 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 5 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 6 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 7 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 8 LIMIT 1)
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 9 LIMIT 1) # 0.6 sec.
	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 10 LIMIT 1) # 6.5 sec.
#	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 11 LIMIT 1) # 112 sec.
#	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 12 LIMIT 1)
#	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 13 LIMIT 1)
#	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 14 LIMIT 1)
#	AND EXISTS (SELECT 1 FROM table_child AS c WHERE c.parent_id = p.id AND c.value = 15 LIMIT 1)
;

SELECT ROUND(NOW(3) - @test_start_time, 3);