-- MySQL dump 10.15  Distrib 10.0.34-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1    Database: test
-- ------------------------------------------------------
-- Server version	10.1.28-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `t1`
--

DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
  `c1` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t1`
--

LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `t2`
--

DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `c2` mediumint(8) NOT NULL,
  `c1` mediumint(8) NOT NULL,
  PRIMARY KEY (`c2`,`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t2`
--

LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES (349,25502),(349,25636),(349,25697),(349,25698),(349,25699),(349,25700),(349,25701),(349,25702),(349,25703),(349,25704),(349,25705),(349,25706),(350,25455),(350,25456),(350,25457),(350,25458),(350,25459),(350,25460),(350,25461),(350,25462),(350,25463),(350,25464),(350,25465),(350,25503),(350,25504),(350,25505),(350,25506),(350,25677),(350,25678),(350,25679),(350,25680),(350,25681),(350,25682),(350,25683),(350,25684),(350,25685),(350,25686),(351,25668),(351,25985),(351,25987),(351,25989),(351,26072),(352,25669),(352,25986),(352,25988),(352,25990),(352,26073),(353,25778),(353,25992),(353,25993),(353,25994),(353,25997),(353,25998),(353,25999),(353,26000),(353,26001),(353,26002),(353,26003),(353,26004),(353,26005),(353,26006),(353,26007),(353,26008),(353,26009),(353,26010),(353,26011),(353,26012),(353,26013),(353,26014),(353,26015),(353,26016),(353,26017),(353,26018),(353,26019),(354,25792),(355,25793),(356,25794),(357,25795),(358,26026);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `t3`
--

DROP TABLE IF EXISTS `t3`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t3` (
  `c2` mediumint(8) NOT NULL AUTO_INCREMENT,
  `c3` mediumint(8) NOT NULL,
  PRIMARY KEY (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t3`
--

LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-03-05 14:39:01
Select version();

set optimizer_search_depth=62;
explain SELECT count(*) FROM t1 WHERE c1 in (SELECT c1 FROM t2 INNER JOIN t3 USING(c2) WHERE c3 = 2000629 );

set optimizer_search_depth=63;
explain SELECT count(*) FROM t1 WHERE c1 in (SELECT c1 FROM t2 INNER JOIN t3 USING(c2) WHERE c3 = 2000629 );


analyze table t1;
analyze table t2;
analyze table t3;

explain SELECT count(*) FROM t1 WHERE c1 in (SELECT c1 FROM t2 INNER JOIN t3 USING(c2) WHERE c3 = 2000629 );

