vitess.io/vitess@v0.16.2/go/vt/vtgate/planbuilder/testdata/info_schema57_cases.json (about)

     1  [
     2    {
     3      "comment": "Single information_schema query",
     4      "query": "select TABLE_NAME from information_schema.TABLES",
     5      "plan": {
     6        "QueryType": "SELECT",
     7        "Original": "select TABLE_NAME from information_schema.TABLES",
     8        "Instructions": {
     9          "OperatorType": "Route",
    10          "Variant": "DBA",
    11          "Keyspace": {
    12            "Name": "main",
    13            "Sharded": false
    14          },
    15          "FieldQuery": "select TABLE_NAME from information_schema.`TABLES` where 1 != 1",
    16          "Query": "select TABLE_NAME from information_schema.`TABLES`",
    17          "Table": "information_schema.`TABLES`"
    18        }
    19      }
    20    },
    21    {
    22      "comment": "',' join information_schema",
    23      "query": "select a.ENGINE, b.DATA_TYPE from information_schema.TABLES as a, information_schema.COLUMNS as b",
    24      "v3-plan": {
    25        "QueryType": "SELECT",
    26        "Original": "select a.ENGINE, b.DATA_TYPE from information_schema.TABLES as a, information_schema.COLUMNS as b",
    27        "Instructions": {
    28          "OperatorType": "Route",
    29          "Variant": "DBA",
    30          "Keyspace": {
    31            "Name": "main",
    32            "Sharded": false
    33          },
    34          "FieldQuery": "select a.`ENGINE`, b.DATA_TYPE from information_schema.`TABLES` as a, information_schema.`COLUMNS` as b where 1 != 1",
    35          "Query": "select a.`ENGINE`, b.DATA_TYPE from information_schema.`TABLES` as a, information_schema.`COLUMNS` as b",
    36          "Table": "information_schema.`TABLES`, information_schema.`COLUMNS`"
    37        }
    38      },
    39      "gen4-plan": {
    40        "QueryType": "SELECT",
    41        "Original": "select a.ENGINE, b.DATA_TYPE from information_schema.TABLES as a, information_schema.COLUMNS as b",
    42        "Instructions": {
    43          "OperatorType": "Route",
    44          "Variant": "DBA",
    45          "Keyspace": {
    46            "Name": "main",
    47            "Sharded": false
    48          },
    49          "FieldQuery": "select a.`ENGINE`, b.DATA_TYPE from information_schema.`TABLES` as a, information_schema.`COLUMNS` as b where 1 != 1",
    50          "Query": "select a.`ENGINE`, b.DATA_TYPE from information_schema.`TABLES` as a, information_schema.`COLUMNS` as b",
    51          "Table": "information_schema.`COLUMNS`, information_schema.`TABLES`"
    52        }
    53      }
    54    },
    55    {
    56      "comment": "information schema query that uses table_schema",
    57      "query": "select column_name from information_schema.columns where table_schema = (select schema())",
    58      "plan": {
    59        "QueryType": "SELECT",
    60        "Original": "select column_name from information_schema.columns where table_schema = (select schema())",
    61        "Instructions": {
    62          "OperatorType": "Route",
    63          "Variant": "DBA",
    64          "Keyspace": {
    65            "Name": "main",
    66            "Sharded": false
    67          },
    68          "FieldQuery": "select column_name from information_schema.`columns` where 1 != 1",
    69          "Query": "select column_name from information_schema.`columns` where table_schema = schema()",
    70          "Table": "information_schema.`columns`"
    71        }
    72      }
    73    },
    74    {
    75      "comment": "information schema join",
    76      "query": "select tables.TABLE_SCHEMA, files.`STATUS` from information_schema.tables join information_schema.files",
    77      "v3-plan": "VT03019: symbol `tables`.TABLE_SCHEMA not found",
    78      "gen4-plan": {
    79        "QueryType": "SELECT",
    80        "Original": "select tables.TABLE_SCHEMA, files.`STATUS` from information_schema.tables join information_schema.files",
    81        "Instructions": {
    82          "OperatorType": "Route",
    83          "Variant": "DBA",
    84          "Keyspace": {
    85            "Name": "main",
    86            "Sharded": false
    87          },
    88          "FieldQuery": "select `tables`.TABLE_SCHEMA, files.`STATUS` from information_schema.`tables`, information_schema.files where 1 != 1",
    89          "Query": "select `tables`.TABLE_SCHEMA, files.`STATUS` from information_schema.`tables`, information_schema.files",
    90          "Table": "information_schema.`tables`, information_schema.files"
    91        }
    92      }
    93    },
    94    {
    95      "comment": "access to qualified column names in information_schema",
    96      "query": "select * from information_schema.COLUMNS where information_schema.COLUMNS.COLUMN_NAME='toto'",
    97      "v3-plan": {
    98        "QueryType": "SELECT",
    99        "Original": "select * from information_schema.COLUMNS where information_schema.COLUMNS.COLUMN_NAME='toto'",
   100        "Instructions": {
   101          "OperatorType": "Route",
   102          "Variant": "DBA",
   103          "Keyspace": {
   104            "Name": "main",
   105            "Sharded": false
   106          },
   107          "FieldQuery": "select * from information_schema.`COLUMNS` where 1 != 1",
   108          "Query": "select * from information_schema.`COLUMNS` where information_schema.`COLUMNS`.COLUMN_NAME = 'toto'",
   109          "Table": "information_schema.`COLUMNS`"
   110        }
   111      },
   112      "gen4-plan": {
   113        "QueryType": "SELECT",
   114        "Original": "select * from information_schema.COLUMNS where information_schema.COLUMNS.COLUMN_NAME='toto'",
   115        "Instructions": {
   116          "OperatorType": "Route",
   117          "Variant": "DBA",
   118          "Keyspace": {
   119            "Name": "main",
   120            "Sharded": false
   121          },
   122          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, DATETIME_PRECISION, CHARACTER_SET_NAME, COLLATION_NAME, COLUMN_TYPE, COLUMN_KEY, EXTRA, `PRIVILEGES`, COLUMN_COMMENT, GENERATION_EXPRESSION from information_schema.`COLUMNS` where 1 != 1",
   123          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, DATETIME_PRECISION, CHARACTER_SET_NAME, COLLATION_NAME, COLUMN_TYPE, COLUMN_KEY, EXTRA, `PRIVILEGES`, COLUMN_COMMENT, GENERATION_EXPRESSION from information_schema.`COLUMNS` where `COLUMNS`.COLUMN_NAME = 'toto'",
   124          "Table": "information_schema.`COLUMNS`"
   125        }
   126      }
   127    },
   128    {
   129      "comment": "union of information_schema",
   130      "query": "select TABLE_NAME from information_schema.columns union select table_schema from information_schema.tables",
   131      "plan": {
   132        "QueryType": "SELECT",
   133        "Original": "select TABLE_NAME from information_schema.columns union select table_schema from information_schema.tables",
   134        "Instructions": {
   135          "OperatorType": "Route",
   136          "Variant": "DBA",
   137          "Keyspace": {
   138            "Name": "main",
   139            "Sharded": false
   140          },
   141          "FieldQuery": "select TABLE_NAME from information_schema.`columns` where 1 != 1 union select table_schema from information_schema.`tables` where 1 != 1",
   142          "Query": "select TABLE_NAME from information_schema.`columns` union select table_schema from information_schema.`tables`",
   143          "Table": "information_schema.`columns`"
   144        }
   145      }
   146    },
   147    {
   148      "comment": "union between information_schema tables that should not be merged",
   149      "query": "select * from information_schema.tables where table_schema = 'user' union select * from information_schema.tables where table_schema = 'main'",
   150      "v3-plan": {
   151        "QueryType": "SELECT",
   152        "Original": "select * from information_schema.tables where table_schema = 'user' union select * from information_schema.tables where table_schema = 'main'",
   153        "Instructions": {
   154          "OperatorType": "Distinct",
   155          "Inputs": [
   156            {
   157              "OperatorType": "Concatenate",
   158              "Inputs": [
   159                {
   160                  "OperatorType": "Route",
   161                  "Variant": "DBA",
   162                  "Keyspace": {
   163                    "Name": "main",
   164                    "Sharded": false
   165                  },
   166                  "FieldQuery": "select * from information_schema.`tables` where 1 != 1",
   167                  "Query": "select * from information_schema.`tables` where table_schema = :__vtschemaname",
   168                  "SysTableTableSchema": "[VARCHAR(\"user\")]",
   169                  "Table": "information_schema.`tables`"
   170                },
   171                {
   172                  "OperatorType": "Route",
   173                  "Variant": "DBA",
   174                  "Keyspace": {
   175                    "Name": "main",
   176                    "Sharded": false
   177                  },
   178                  "FieldQuery": "select * from information_schema.`tables` where 1 != 1",
   179                  "Query": "select * from information_schema.`tables` where table_schema = :__vtschemaname",
   180                  "SysTableTableSchema": "[VARCHAR(\"main\")]",
   181                  "Table": "information_schema.`tables`"
   182                }
   183              ]
   184            }
   185          ]
   186        }
   187      },
   188      "gen4-plan": {
   189        "QueryType": "SELECT",
   190        "Original": "select * from information_schema.tables where table_schema = 'user' union select * from information_schema.tables where table_schema = 'main'",
   191        "Instructions": {
   192          "OperatorType": "Distinct",
   193          "Collations": [
   194            "(0:21)",
   195            "(1:22)",
   196            "(2:23)",
   197            "(3:24)",
   198            "(4:25)",
   199            "5: binary",
   200            "(6:26)",
   201            "7: binary",
   202            "8: binary",
   203            "9: binary",
   204            "10: binary",
   205            "11: binary",
   206            "12: binary",
   207            "13: binary",
   208            "(14:27)",
   209            "(15:28)",
   210            "(16:29)",
   211            "(17:30)",
   212            "18: binary",
   213            "(19:31)",
   214            "(20:32)"
   215          ],
   216          "ResultColumns": 21,
   217          "Inputs": [
   218            {
   219              "OperatorType": "Concatenate",
   220              "Inputs": [
   221                {
   222                  "OperatorType": "Route",
   223                  "Variant": "DBA",
   224                  "Keyspace": {
   225                    "Name": "main",
   226                    "Sharded": false
   227                  },
   228                  "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT, weight_string(TABLE_CATALOG), weight_string(TABLE_SCHEMA), weight_string(TABLE_NAME), weight_string(TABLE_TYPE), weight_string(`ENGINE`), weight_string(`ROW_FORMAT`), weight_string(CREATE_TIME), weight_string(UPDATE_TIME), weight_string(CHECK_TIME), weight_string(TABLE_COLLATION), weight_string(CREATE_OPTIONS), weight_string(TABLE_COMMENT) from information_schema.`tables` where 1 != 1",
   229                  "Query": "select distinct TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT, weight_string(TABLE_CATALOG), weight_string(TABLE_SCHEMA), weight_string(TABLE_NAME), weight_string(TABLE_TYPE), weight_string(`ENGINE`), weight_string(`ROW_FORMAT`), weight_string(CREATE_TIME), weight_string(UPDATE_TIME), weight_string(CHECK_TIME), weight_string(TABLE_COLLATION), weight_string(CREATE_OPTIONS), weight_string(TABLE_COMMENT) from information_schema.`tables` where table_schema = :__vtschemaname",
   230                  "SysTableTableSchema": "[VARCHAR(\"user\")]",
   231                  "Table": "information_schema.`tables`"
   232                },
   233                {
   234                  "OperatorType": "Route",
   235                  "Variant": "DBA",
   236                  "Keyspace": {
   237                    "Name": "main",
   238                    "Sharded": false
   239                  },
   240                  "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT, weight_string(TABLE_CATALOG), weight_string(TABLE_SCHEMA), weight_string(TABLE_NAME), weight_string(TABLE_TYPE), weight_string(`ENGINE`), weight_string(`ROW_FORMAT`), weight_string(CREATE_TIME), weight_string(UPDATE_TIME), weight_string(CHECK_TIME), weight_string(TABLE_COLLATION), weight_string(CREATE_OPTIONS), weight_string(TABLE_COMMENT) from information_schema.`tables` where 1 != 1",
   241                  "Query": "select distinct TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT, weight_string(TABLE_CATALOG), weight_string(TABLE_SCHEMA), weight_string(TABLE_NAME), weight_string(TABLE_TYPE), weight_string(`ENGINE`), weight_string(`ROW_FORMAT`), weight_string(CREATE_TIME), weight_string(UPDATE_TIME), weight_string(CHECK_TIME), weight_string(TABLE_COLLATION), weight_string(CREATE_OPTIONS), weight_string(TABLE_COMMENT) from information_schema.`tables` where table_schema = :__vtschemaname",
   242                  "SysTableTableSchema": "[VARCHAR(\"main\")]",
   243                  "Table": "information_schema.`tables`"
   244                }
   245              ]
   246            }
   247          ]
   248        }
   249      }
   250    },
   251    {
   252      "comment": "Select from information schema query with two tables that route should be merged",
   253      "query": "SELECT RC.CONSTRAINT_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.COLUMN_NAME = 'id' AND KCU.REFERENCED_TABLE_SCHEMA = 'test' AND KCU.CONSTRAINT_NAME = 'data_type_table_id_fkey' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   254      "v3-plan": {
   255        "QueryType": "SELECT",
   256        "Original": "SELECT RC.CONSTRAINT_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.COLUMN_NAME = 'id' AND KCU.REFERENCED_TABLE_SCHEMA = 'test' AND KCU.CONSTRAINT_NAME = 'data_type_table_id_fkey' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   257        "Instructions": {
   258          "OperatorType": "Route",
   259          "Variant": "DBA",
   260          "Keyspace": {
   261            "Name": "main",
   262            "Sharded": false
   263          },
   264          "FieldQuery": "select RC.CONSTRAINT_NAME, ORDINAL_POSITION from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU join INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC on KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME where 1 != 1",
   265          "Query": "select RC.CONSTRAINT_NAME, ORDINAL_POSITION from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU join INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC on KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME where KCU.TABLE_SCHEMA = :__vtschemaname and KCU.TABLE_NAME = :KCU_TABLE_NAME and KCU.COLUMN_NAME = 'id' and KCU.REFERENCED_TABLE_SCHEMA = :__vtschemaname and KCU.CONSTRAINT_NAME = 'data_type_table_id_fkey' order by KCU.CONSTRAINT_NAME asc, KCU.COLUMN_NAME asc",
   266          "SysTableTableName": "[KCU_TABLE_NAME:VARCHAR(\"data_type_table\")]",
   267          "SysTableTableSchema": "[VARCHAR(\"test\"), VARCHAR(\"test\")]",
   268          "Table": "INFORMATION_SCHEMA.KEY_COLUMN_USAGE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS"
   269        }
   270      },
   271      "gen4-plan": {
   272        "QueryType": "SELECT",
   273        "Original": "SELECT RC.CONSTRAINT_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.COLUMN_NAME = 'id' AND KCU.REFERENCED_TABLE_SCHEMA = 'test' AND KCU.CONSTRAINT_NAME = 'data_type_table_id_fkey' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   274        "Instructions": {
   275          "OperatorType": "Route",
   276          "Variant": "DBA",
   277          "Keyspace": {
   278            "Name": "main",
   279            "Sharded": false
   280          },
   281          "FieldQuery": "select RC.CONSTRAINT_NAME, ORDINAL_POSITION from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC where 1 != 1",
   282          "Query": "select RC.CONSTRAINT_NAME, ORDINAL_POSITION from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC where KCU.TABLE_SCHEMA = :__vtschemaname and KCU.TABLE_NAME = :KCU_TABLE_NAME and KCU.COLUMN_NAME = 'id' and KCU.REFERENCED_TABLE_SCHEMA = 'test' and KCU.CONSTRAINT_NAME = 'data_type_table_id_fkey' and KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME order by KCU.CONSTRAINT_NAME asc, KCU.COLUMN_NAME asc",
   283          "SysTableTableName": "[KCU_TABLE_NAME:VARCHAR(\"data_type_table\")]",
   284          "SysTableTableSchema": "[VARCHAR(\"test\")]",
   285          "Table": "INFORMATION_SCHEMA.KEY_COLUMN_USAGE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS"
   286        }
   287      }
   288    },
   289    {
   290      "comment": "Select from information schema query with three tables such that route for 2 should be merged but not for the last.",
   291      "query": "SELECT KCU.`TABLE_NAME`, S.`TABLE_NAME` FROM  INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME, INFORMATION_SCHEMA.`TABLES` AS S WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.TABLE_NAME = 'data_type_table' AND S.TABLE_SCHEMA = 'test' AND S.TABLE_NAME = 'sc' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   292      "v3-plan": {
   293        "QueryType": "SELECT",
   294        "Original": "SELECT KCU.`TABLE_NAME`, S.`TABLE_NAME` FROM  INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME, INFORMATION_SCHEMA.`TABLES` AS S WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.TABLE_NAME = 'data_type_table' AND S.TABLE_SCHEMA = 'test' AND S.TABLE_NAME = 'sc' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   295        "Instructions": {
   296          "OperatorType": "Join",
   297          "Variant": "Join",
   298          "JoinColumnIndexes": "L:0,R:0",
   299          "TableName": "INFORMATION_SCHEMA.KEY_COLUMN_USAGE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS_INFORMATION_SCHEMA.`TABLES`",
   300          "Inputs": [
   301            {
   302              "OperatorType": "Route",
   303              "Variant": "DBA",
   304              "Keyspace": {
   305                "Name": "main",
   306                "Sharded": false
   307              },
   308              "FieldQuery": "select KCU.TABLE_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU join INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC on KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME where 1 != 1",
   309              "Query": "select KCU.TABLE_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU join INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC on KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME where KCU.TABLE_SCHEMA = :__vtschemaname and KCU.TABLE_NAME = :KCU_TABLE_NAME and KCU.TABLE_NAME = :KCU_TABLE_NAME1 order by KCU.CONSTRAINT_NAME asc, KCU.COLUMN_NAME asc",
   310              "SysTableTableName": "[KCU_TABLE_NAME1:VARCHAR(\"data_type_table\"), KCU_TABLE_NAME:VARCHAR(\"data_type_table\")]",
   311              "SysTableTableSchema": "[VARCHAR(\"test\")]",
   312              "Table": "INFORMATION_SCHEMA.KEY_COLUMN_USAGE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS"
   313            },
   314            {
   315              "OperatorType": "Route",
   316              "Variant": "DBA",
   317              "Keyspace": {
   318                "Name": "main",
   319                "Sharded": false
   320              },
   321              "FieldQuery": "select S.TABLE_NAME from INFORMATION_SCHEMA.`TABLES` as S where 1 != 1",
   322              "Query": "select S.TABLE_NAME from INFORMATION_SCHEMA.`TABLES` as S where S.TABLE_SCHEMA = :__vtschemaname and S.TABLE_NAME = :S_TABLE_NAME",
   323              "SysTableTableName": "[S_TABLE_NAME:VARCHAR(\"sc\")]",
   324              "SysTableTableSchema": "[VARCHAR(\"test\")]",
   325              "Table": "INFORMATION_SCHEMA.`TABLES`"
   326            }
   327          ]
   328        }
   329      },
   330      "gen4-plan": {
   331        "QueryType": "SELECT",
   332        "Original": "SELECT KCU.`TABLE_NAME`, S.`TABLE_NAME` FROM  INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME, INFORMATION_SCHEMA.`TABLES` AS S WHERE KCU.TABLE_SCHEMA = 'test' AND KCU.TABLE_NAME = 'data_type_table' AND KCU.TABLE_NAME = 'data_type_table' AND S.TABLE_SCHEMA = 'test' AND S.TABLE_NAME = 'sc' ORDER BY KCU.CONSTRAINT_NAME, KCU.COLUMN_NAME",
   333        "Instructions": {
   334          "OperatorType": "Route",
   335          "Variant": "DBA",
   336          "Keyspace": {
   337            "Name": "main",
   338            "Sharded": false
   339          },
   340          "FieldQuery": "select KCU.TABLE_NAME, S.TABLE_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC, INFORMATION_SCHEMA.`TABLES` as S where 1 != 1",
   341          "Query": "select KCU.TABLE_NAME, S.TABLE_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as RC, INFORMATION_SCHEMA.`TABLES` as S where S.TABLE_SCHEMA = :__vtschemaname and S.TABLE_NAME = :S_TABLE_NAME and KCU.TABLE_SCHEMA = :__vtschemaname and KCU.TABLE_NAME = :KCU_TABLE_NAME and KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME order by KCU.CONSTRAINT_NAME asc, KCU.COLUMN_NAME asc",
   342          "SysTableTableName": "[KCU_TABLE_NAME:VARCHAR(\"data_type_table\"), S_TABLE_NAME:VARCHAR(\"sc\")]",
   343          "SysTableTableSchema": "[VARCHAR(\"test\"), VARCHAR(\"test\")]",
   344          "Table": "INFORMATION_SCHEMA.KEY_COLUMN_USAGE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS, INFORMATION_SCHEMA.`TABLES`"
   345        }
   346      }
   347    },
   348    {
   349      "comment": "information_schema.routines",
   350      "query": "SELECT routine_name AS name, routine_definition AS definition FROM information_schema.routines WHERE ROUTINE_SCHEMA = ? AND ROUTINE_TYPE = 'PROCEDURE'",
   351      "plan": {
   352        "QueryType": "SELECT",
   353        "Original": "SELECT routine_name AS name, routine_definition AS definition FROM information_schema.routines WHERE ROUTINE_SCHEMA = ? AND ROUTINE_TYPE = 'PROCEDURE'",
   354        "Instructions": {
   355          "OperatorType": "Route",
   356          "Variant": "DBA",
   357          "Keyspace": {
   358            "Name": "main",
   359            "Sharded": false
   360          },
   361          "FieldQuery": "select routine_name as `name`, routine_definition as definition from information_schema.routines where 1 != 1",
   362          "Query": "select routine_name as `name`, routine_definition as definition from information_schema.routines where ROUTINE_SCHEMA = :__vtschemaname and ROUTINE_TYPE = 'PROCEDURE'",
   363          "SysTableTableSchema": "[:v1]",
   364          "Table": "information_schema.routines"
   365        }
   366      }
   367    },
   368    {
   369      "comment": "information_schema table sizes",
   370      "query": "SELECT SUM(data_length + index_length) as size FROM information_schema.TABLES WHERE table_schema = ?",
   371      "plan": {
   372        "QueryType": "SELECT",
   373        "Original": "SELECT SUM(data_length + index_length) as size FROM information_schema.TABLES WHERE table_schema = ?",
   374        "Instructions": {
   375          "OperatorType": "Route",
   376          "Variant": "DBA",
   377          "Keyspace": {
   378            "Name": "main",
   379            "Sharded": false
   380          },
   381          "FieldQuery": "select sum(data_length + index_length) as size from information_schema.`TABLES` where 1 != 1",
   382          "Query": "select sum(data_length + index_length) as size from information_schema.`TABLES` where table_schema = :__vtschemaname",
   383          "SysTableTableSchema": "[:v1]",
   384          "Table": "information_schema.`TABLES`"
   385        }
   386      }
   387    },
   388    {
   389      "comment": "information_schema referential contraints",
   390      "query": "SELECT kcu.constraint_name constraint_name, kcu.column_name column_name, kcu.referenced_table_name referenced_table_name, kcu.referenced_column_name referenced_column_name, kcu.ordinal_position ordinal_position, kcu.table_name table_name, rc.delete_rule delete_rule, rc.update_rule update_rule FROM information_schema.key_column_usage AS kcu INNER JOIN information_schema.referential_constraints AS rc ON kcu.constraint_name = rc.constraint_name WHERE kcu.table_schema = ? AND rc.constraint_schema = ? AND kcu.referenced_column_name IS NOT NULL ORDER BY ordinal_position",
   391      "v3-plan": {
   392        "QueryType": "SELECT",
   393        "Original": "SELECT kcu.constraint_name constraint_name, kcu.column_name column_name, kcu.referenced_table_name referenced_table_name, kcu.referenced_column_name referenced_column_name, kcu.ordinal_position ordinal_position, kcu.table_name table_name, rc.delete_rule delete_rule, rc.update_rule update_rule FROM information_schema.key_column_usage AS kcu INNER JOIN information_schema.referential_constraints AS rc ON kcu.constraint_name = rc.constraint_name WHERE kcu.table_schema = ? AND rc.constraint_schema = ? AND kcu.referenced_column_name IS NOT NULL ORDER BY ordinal_position",
   394        "Instructions": {
   395          "OperatorType": "Route",
   396          "Variant": "DBA",
   397          "Keyspace": {
   398            "Name": "main",
   399            "Sharded": false
   400          },
   401          "FieldQuery": "select kcu.constraint_name as constraint_name, kcu.column_name as column_name, kcu.referenced_table_name as referenced_table_name, kcu.referenced_column_name as referenced_column_name, kcu.ordinal_position as ordinal_position, kcu.table_name as table_name, rc.delete_rule as delete_rule, rc.update_rule as update_rule from information_schema.key_column_usage as kcu join information_schema.referential_constraints as rc on kcu.constraint_name = rc.constraint_name where 1 != 1",
   402          "Query": "select kcu.constraint_name as constraint_name, kcu.column_name as column_name, kcu.referenced_table_name as referenced_table_name, kcu.referenced_column_name as referenced_column_name, kcu.ordinal_position as ordinal_position, kcu.table_name as table_name, rc.delete_rule as delete_rule, rc.update_rule as update_rule from information_schema.key_column_usage as kcu join information_schema.referential_constraints as rc on kcu.constraint_name = rc.constraint_name where kcu.table_schema = :__vtschemaname and rc.constraint_schema = :__vtschemaname and kcu.referenced_column_name is not null order by ordinal_position asc",
   403          "SysTableTableSchema": "[:v1, :v2]",
   404          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
   405        }
   406      },
   407      "gen4-plan": {
   408        "QueryType": "SELECT",
   409        "Original": "SELECT kcu.constraint_name constraint_name, kcu.column_name column_name, kcu.referenced_table_name referenced_table_name, kcu.referenced_column_name referenced_column_name, kcu.ordinal_position ordinal_position, kcu.table_name table_name, rc.delete_rule delete_rule, rc.update_rule update_rule FROM information_schema.key_column_usage AS kcu INNER JOIN information_schema.referential_constraints AS rc ON kcu.constraint_name = rc.constraint_name WHERE kcu.table_schema = ? AND rc.constraint_schema = ? AND kcu.referenced_column_name IS NOT NULL ORDER BY ordinal_position",
   410        "Instructions": {
   411          "OperatorType": "Route",
   412          "Variant": "DBA",
   413          "Keyspace": {
   414            "Name": "main",
   415            "Sharded": false
   416          },
   417          "FieldQuery": "select kcu.constraint_name as constraint_name, kcu.column_name as column_name, kcu.referenced_table_name as referenced_table_name, kcu.referenced_column_name as referenced_column_name, kcu.ordinal_position as ordinal_position, kcu.table_name as table_name, rc.delete_rule as delete_rule, rc.update_rule as update_rule from information_schema.key_column_usage as kcu, information_schema.referential_constraints as rc where 1 != 1",
   418          "Query": "select kcu.constraint_name as constraint_name, kcu.column_name as column_name, kcu.referenced_table_name as referenced_table_name, kcu.referenced_column_name as referenced_column_name, kcu.ordinal_position as ordinal_position, kcu.table_name as table_name, rc.delete_rule as delete_rule, rc.update_rule as update_rule from information_schema.key_column_usage as kcu, information_schema.referential_constraints as rc where kcu.table_schema = :__vtschemaname and kcu.referenced_column_name is not null and rc.constraint_schema = :__vtschemaname and kcu.constraint_name = rc.constraint_name order by ordinal_position asc",
   419          "SysTableTableSchema": "[:v1, :v2]",
   420          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
   421        }
   422      }
   423    },
   424    {
   425      "comment": "rails query",
   426      "query": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as name, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where fk.referenced_column_name is not null and fk.table_schema = database() and fk.table_name = ':vtg1' and rc.constraint_schema = database() and rc.table_name = ':vtg1'",
   427      "v3-plan": {
   428        "QueryType": "SELECT",
   429        "Original": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as name, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where fk.referenced_column_name is not null and fk.table_schema = database() and fk.table_name = ':vtg1' and rc.constraint_schema = database() and rc.table_name = ':vtg1'",
   430        "Instructions": {
   431          "OperatorType": "Route",
   432          "Variant": "DBA",
   433          "Keyspace": {
   434            "Name": "main",
   435            "Sharded": false
   436          },
   437          "FieldQuery": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where 1 != 1",
   438          "Query": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where fk.referenced_column_name is not null and fk.table_schema = database() and fk.table_name = :fk_table_name and rc.constraint_schema = database() and rc.table_name = :rc_table_name",
   439          "SysTableTableName": "[fk_table_name:VARCHAR(\":vtg1\"), rc_table_name:VARCHAR(\":vtg1\")]",
   440          "Table": "information_schema.referential_constraints, information_schema.key_column_usage"
   441        }
   442      },
   443      "gen4-plan": {
   444        "QueryType": "SELECT",
   445        "Original": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as name, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where fk.referenced_column_name is not null and fk.table_schema = database() and fk.table_name = ':vtg1' and rc.constraint_schema = database() and rc.table_name = ':vtg1'",
   446        "Instructions": {
   447          "OperatorType": "Route",
   448          "Variant": "DBA",
   449          "Keyspace": {
   450            "Name": "main",
   451            "Sharded": false
   452          },
   453          "FieldQuery": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc, information_schema.key_column_usage as fk where 1 != 1",
   454          "Query": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc, information_schema.key_column_usage as fk where rc.constraint_schema = database() and rc.table_name = :rc_table_name and fk.referenced_column_name is not null and fk.table_schema = database() and fk.table_name = :fk_table_name and rc.constraint_schema = fk.constraint_schema and rc.constraint_name = fk.constraint_name",
   455          "SysTableTableName": "[fk_table_name:VARCHAR(\":vtg1\"), rc_table_name:VARCHAR(\":vtg1\")]",
   456          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
   457        }
   458      }
   459    },
   460    {
   461      "comment": "rails_query 2",
   462      "query": "SELECT * FROM information_schema.schemata WHERE schema_name = 'user'",
   463      "v3-plan": {
   464        "QueryType": "SELECT",
   465        "Original": "SELECT * FROM information_schema.schemata WHERE schema_name = 'user'",
   466        "Instructions": {
   467          "OperatorType": "Route",
   468          "Variant": "DBA",
   469          "Keyspace": {
   470            "Name": "main",
   471            "Sharded": false
   472          },
   473          "FieldQuery": "select * from information_schema.schemata where 1 != 1",
   474          "Query": "select * from information_schema.schemata where schema_name = :__vtschemaname",
   475          "SysTableTableSchema": "[VARCHAR(\"user\")]",
   476          "Table": "information_schema.schemata"
   477        }
   478      },
   479      "gen4-plan": {
   480        "QueryType": "SELECT",
   481        "Original": "SELECT * FROM information_schema.schemata WHERE schema_name = 'user'",
   482        "Instructions": {
   483          "OperatorType": "Route",
   484          "Variant": "DBA",
   485          "Keyspace": {
   486            "Name": "main",
   487            "Sharded": false
   488          },
   489          "FieldQuery": "select CATALOG_NAME, SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME, SQL_PATH from information_schema.schemata where 1 != 1",
   490          "Query": "select CATALOG_NAME, SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME, SQL_PATH from information_schema.schemata where schema_name = :__vtschemaname",
   491          "SysTableTableSchema": "[VARCHAR(\"user\")]",
   492          "Table": "information_schema.schemata"
   493        }
   494      }
   495    },
   496    {
   497      "comment": "rails_query 3",
   498      "query": "SELECT table_comment FROM information_schema.tables WHERE table_schema = 'schema_name' AND table_name = 'table_name'",
   499      "plan": {
   500        "QueryType": "SELECT",
   501        "Original": "SELECT table_comment FROM information_schema.tables WHERE table_schema = 'schema_name' AND table_name = 'table_name'",
   502        "Instructions": {
   503          "OperatorType": "Route",
   504          "Variant": "DBA",
   505          "Keyspace": {
   506            "Name": "main",
   507            "Sharded": false
   508          },
   509          "FieldQuery": "select table_comment from information_schema.`tables` where 1 != 1",
   510          "Query": "select table_comment from information_schema.`tables` where table_schema = :__vtschemaname and table_name = :table_name",
   511          "SysTableTableName": "[table_name:VARCHAR(\"table_name\")]",
   512          "SysTableTableSchema": "[VARCHAR(\"schema_name\")]",
   513          "Table": "information_schema.`tables`"
   514        }
   515      }
   516    },
   517    {
   518      "comment": "rails_query 4",
   519      "query": "SELECT fk.referenced_table_name AS 'to_table', fk.referenced_column_name AS 'primary_key',fk.column_name AS 'column',fk.constraint_name AS 'name',rc.update_rule AS 'on_update',rc.delete_rule AS 'on_delete' FROM information_schema.referential_constraints rc JOIN information_schema.key_column_usage fk USING (constraint_schema, constraint_name) WHERE fk.referenced_column_name IS NOT NULL AND fk.table_schema = 'table_schema' AND fk.table_name = 'table_name' AND rc.constraint_schema = 'table_schema' AND rc.table_name = 'table_name'",
   520      "v3-plan": {
   521        "QueryType": "SELECT",
   522        "Original": "SELECT fk.referenced_table_name AS 'to_table', fk.referenced_column_name AS 'primary_key',fk.column_name AS 'column',fk.constraint_name AS 'name',rc.update_rule AS 'on_update',rc.delete_rule AS 'on_delete' FROM information_schema.referential_constraints rc JOIN information_schema.key_column_usage fk USING (constraint_schema, constraint_name) WHERE fk.referenced_column_name IS NOT NULL AND fk.table_schema = 'table_schema' AND fk.table_name = 'table_name' AND rc.constraint_schema = 'table_schema' AND rc.table_name = 'table_name'",
   523        "Instructions": {
   524          "OperatorType": "Route",
   525          "Variant": "DBA",
   526          "Keyspace": {
   527            "Name": "main",
   528            "Sharded": false
   529          },
   530          "FieldQuery": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where 1 != 1",
   531          "Query": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc join information_schema.key_column_usage as fk using (constraint_schema, constraint_name) where fk.referenced_column_name is not null and fk.table_schema = :__vtschemaname and fk.table_name = :fk_table_name and rc.constraint_schema = :__vtschemaname and rc.table_name = :rc_table_name",
   532          "SysTableTableName": "[fk_table_name:VARCHAR(\"table_name\"), rc_table_name:VARCHAR(\"table_name\")]",
   533          "SysTableTableSchema": "[VARCHAR(\"table_schema\"), VARCHAR(\"table_schema\")]",
   534          "Table": "information_schema.referential_constraints, information_schema.key_column_usage"
   535        }
   536      },
   537      "gen4-plan": {
   538        "QueryType": "SELECT",
   539        "Original": "SELECT fk.referenced_table_name AS 'to_table', fk.referenced_column_name AS 'primary_key',fk.column_name AS 'column',fk.constraint_name AS 'name',rc.update_rule AS 'on_update',rc.delete_rule AS 'on_delete' FROM information_schema.referential_constraints rc JOIN information_schema.key_column_usage fk USING (constraint_schema, constraint_name) WHERE fk.referenced_column_name IS NOT NULL AND fk.table_schema = 'table_schema' AND fk.table_name = 'table_name' AND rc.constraint_schema = 'table_schema' AND rc.table_name = 'table_name'",
   540        "Instructions": {
   541          "OperatorType": "Route",
   542          "Variant": "DBA",
   543          "Keyspace": {
   544            "Name": "main",
   545            "Sharded": false
   546          },
   547          "FieldQuery": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc, information_schema.key_column_usage as fk where 1 != 1",
   548          "Query": "select fk.referenced_table_name as to_table, fk.referenced_column_name as primary_key, fk.column_name as `column`, fk.constraint_name as `name`, rc.update_rule as on_update, rc.delete_rule as on_delete from information_schema.referential_constraints as rc, information_schema.key_column_usage as fk where rc.constraint_schema = :__vtschemaname and rc.table_name = :rc_table_name and fk.referenced_column_name is not null and fk.table_schema = :__vtschemaname and fk.table_name = :fk_table_name and rc.constraint_schema = fk.constraint_schema and rc.constraint_name = fk.constraint_name",
   549          "SysTableTableName": "[fk_table_name:VARCHAR(\"table_name\"), rc_table_name:VARCHAR(\"table_name\")]",
   550          "SysTableTableSchema": "[VARCHAR(\"table_schema\"), VARCHAR(\"table_schema\")]",
   551          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
   552        }
   553      }
   554    },
   555    {
   556      "comment": "rails_query 6",
   557      "query": "SELECT column_name FROM information_schema.statistics WHERE index_name = 'PRIMARY' AND table_schema = 'table_schema' AND table_name = 'table_name' ORDER BY seq_in_index",
   558      "plan": {
   559        "QueryType": "SELECT",
   560        "Original": "SELECT column_name FROM information_schema.statistics WHERE index_name = 'PRIMARY' AND table_schema = 'table_schema' AND table_name = 'table_name' ORDER BY seq_in_index",
   561        "Instructions": {
   562          "OperatorType": "Route",
   563          "Variant": "DBA",
   564          "Keyspace": {
   565            "Name": "main",
   566            "Sharded": false
   567          },
   568          "FieldQuery": "select column_name from information_schema.statistics where 1 != 1",
   569          "Query": "select column_name from information_schema.statistics where index_name = 'PRIMARY' and table_schema = :__vtschemaname and table_name = :table_name order by seq_in_index asc",
   570          "SysTableTableName": "[table_name:VARCHAR(\"table_name\")]",
   571          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   572          "Table": "information_schema.statistics"
   573        }
   574      }
   575    },
   576    {
   577      "comment": "rails_query 7",
   578      "query": "SELECT generation_expression FROM information_schema.columns WHERE table_schema = 'table_schema' AND table_name = 'table_name' AND column_name = 'column_name'",
   579      "plan": {
   580        "QueryType": "SELECT",
   581        "Original": "SELECT generation_expression FROM information_schema.columns WHERE table_schema = 'table_schema' AND table_name = 'table_name' AND column_name = 'column_name'",
   582        "Instructions": {
   583          "OperatorType": "Route",
   584          "Variant": "DBA",
   585          "Keyspace": {
   586            "Name": "main",
   587            "Sharded": false
   588          },
   589          "FieldQuery": "select generation_expression from information_schema.`columns` where 1 != 1",
   590          "Query": "select generation_expression from information_schema.`columns` where table_schema = :__vtschemaname and table_name = :table_name and column_name = 'column_name'",
   591          "SysTableTableName": "[table_name:VARCHAR(\"table_name\")]",
   592          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   593          "Table": "information_schema.`columns`"
   594        }
   595      }
   596    },
   597    {
   598      "comment": "rails_query 8",
   599      "query": "SELECT id FROM information_schema.processlist WHERE info LIKE '% FOR UPDATE'",
   600      "plan": {
   601        "QueryType": "SELECT",
   602        "Original": "SELECT id FROM information_schema.processlist WHERE info LIKE '% FOR UPDATE'",
   603        "Instructions": {
   604          "OperatorType": "Route",
   605          "Variant": "DBA",
   606          "Keyspace": {
   607            "Name": "main",
   608            "Sharded": false
   609          },
   610          "FieldQuery": "select id from information_schema.`processlist` where 1 != 1",
   611          "Query": "select id from information_schema.`processlist` where info like '% FOR UPDATE'",
   612          "Table": "information_schema.`processlist`"
   613        }
   614      }
   615    },
   616    {
   617      "comment": "rails_query 9",
   618      "query": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery",
   619      "v3-plan": {
   620        "QueryType": "SELECT",
   621        "Original": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery",
   622        "Instructions": {
   623          "OperatorType": "Route",
   624          "Variant": "DBA",
   625          "Keyspace": {
   626            "Name": "main",
   627            "Sharded": false
   628          },
   629          "FieldQuery": "select table_name from (select * from information_schema.`tables` where 1 != 1) as _subquery where 1 != 1",
   630          "Query": "select table_name from (select * from information_schema.`tables` where table_schema = :__vtschemaname) as _subquery",
   631          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   632          "Table": "information_schema.`tables`"
   633        }
   634      },
   635      "gen4-plan": {
   636        "QueryType": "SELECT",
   637        "Original": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery",
   638        "Instructions": {
   639          "OperatorType": "Route",
   640          "Variant": "DBA",
   641          "Keyspace": {
   642            "Name": "main",
   643            "Sharded": false
   644          },
   645          "FieldQuery": "select table_name from (select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from information_schema.`tables` where 1 != 1) as _subquery where 1 != 1",
   646          "Query": "select table_name from (select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from information_schema.`tables` where table_schema = :__vtschemaname) as _subquery",
   647          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   648          "Table": "information_schema.`tables`"
   649        }
   650      }
   651    },
   652    {
   653      "comment": "rails_query 10",
   654      "query": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery WHERE _subquery.table_type = 'table_type' AND _subquery.table_name = 'table_name'",
   655      "v3-plan": {
   656        "QueryType": "SELECT",
   657        "Original": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery WHERE _subquery.table_type = 'table_type' AND _subquery.table_name = 'table_name'",
   658        "Instructions": {
   659          "OperatorType": "Route",
   660          "Variant": "DBA",
   661          "Keyspace": {
   662            "Name": "main",
   663            "Sharded": false
   664          },
   665          "FieldQuery": "select table_name from (select * from information_schema.`tables` where 1 != 1) as _subquery where 1 != 1",
   666          "Query": "select table_name from (select * from information_schema.`tables` where table_schema = :__vtschemaname) as _subquery where _subquery.table_type = 'table_type' and _subquery.table_name = :_subquery_table_name",
   667          "SysTableTableName": "[_subquery_table_name:VARCHAR(\"table_name\")]",
   668          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   669          "Table": "information_schema.`tables`"
   670        }
   671      },
   672      "gen4-plan": {
   673        "QueryType": "SELECT",
   674        "Original": "SELECT table_name FROM (SELECT * FROM information_schema.tables WHERE table_schema = 'table_schema') _subquery WHERE _subquery.table_type = 'table_type' AND _subquery.table_name = 'table_name'",
   675        "Instructions": {
   676          "OperatorType": "Route",
   677          "Variant": "DBA",
   678          "Keyspace": {
   679            "Name": "main",
   680            "Sharded": false
   681          },
   682          "FieldQuery": "select table_name from (select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from information_schema.`tables` where 1 != 1) as _subquery where 1 != 1",
   683          "Query": "select table_name from (select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from information_schema.`tables` where table_schema = :__vtschemaname and table_type = 'table_type' and table_name = 'table_name') as _subquery",
   684          "SysTableTableSchema": "[VARCHAR(\"table_schema\")]",
   685          "Table": "information_schema.`tables`"
   686        }
   687      }
   688    },
   689    {
   690      "comment": "system schema in where clause of information_schema query",
   691      "query": "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'performance_schema' AND table_name = 'foo'",
   692      "plan": {
   693        "QueryType": "SELECT",
   694        "Original": "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'performance_schema' AND table_name = 'foo'",
   695        "Instructions": {
   696          "OperatorType": "Route",
   697          "Variant": "DBA",
   698          "Keyspace": {
   699            "Name": "main",
   700            "Sharded": false
   701          },
   702          "FieldQuery": "select count(*) from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   703          "Query": "select count(*) from INFORMATION_SCHEMA.`TABLES` where table_schema = :__vtschemaname and table_name = :table_name",
   704          "SysTableTableName": "[table_name:VARCHAR(\"foo\")]",
   705          "SysTableTableSchema": "[VARCHAR(\"performance_schema\")]",
   706          "Table": "INFORMATION_SCHEMA.`TABLES`"
   707        }
   708      }
   709    },
   710    {
   711      "comment": "subquery of information_schema with itself",
   712      "query": "select TABLES.CHECKSUM from information_schema.`TABLES` where `TABLE_NAME` in (select `TABLE_NAME` from information_schema.`COLUMNS`)",
   713      "v3-plan": "VT03019: symbol `TABLES`.`CHECKSUM` not found",
   714      "gen4-plan": {
   715        "QueryType": "SELECT",
   716        "Original": "select TABLES.CHECKSUM from information_schema.`TABLES` where `TABLE_NAME` in (select `TABLE_NAME` from information_schema.`COLUMNS`)",
   717        "Instructions": {
   718          "OperatorType": "Route",
   719          "Variant": "DBA",
   720          "Keyspace": {
   721            "Name": "main",
   722            "Sharded": false
   723          },
   724          "FieldQuery": "select `TABLES`.`CHECKSUM` from information_schema.`TABLES` where 1 != 1",
   725          "Query": "select `TABLES`.`CHECKSUM` from information_schema.`TABLES` where TABLE_NAME in (select TABLE_NAME from information_schema.`COLUMNS`)",
   726          "Table": "information_schema.`TABLES`"
   727        }
   728      }
   729    },
   730    {
   731      "comment": "query trying to query two different keyspaces at the same time",
   732      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'user' AND TABLE_SCHEMA = 'main'",
   733      "v3-plan": {
   734        "QueryType": "SELECT",
   735        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'user' AND TABLE_SCHEMA = 'main'",
   736        "Instructions": {
   737          "OperatorType": "Route",
   738          "Variant": "DBA",
   739          "Keyspace": {
   740            "Name": "main",
   741            "Sharded": false
   742          },
   743          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   744          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname",
   745          "SysTableTableSchema": "[VARCHAR(\"user\"), VARCHAR(\"main\")]",
   746          "Table": "INFORMATION_SCHEMA.`TABLES`"
   747        }
   748      },
   749      "gen4-plan": {
   750        "QueryType": "SELECT",
   751        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'user' AND TABLE_SCHEMA = 'main'",
   752        "Instructions": {
   753          "OperatorType": "Route",
   754          "Variant": "DBA",
   755          "Keyspace": {
   756            "Name": "main",
   757            "Sharded": false
   758          },
   759          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   760          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname",
   761          "SysTableTableSchema": "[VARCHAR(\"user\"), VARCHAR(\"main\")]",
   762          "Table": "INFORMATION_SCHEMA.`TABLES`"
   763        }
   764      }
   765    },
   766    {
   767      "comment": "information_schema query using database() func",
   768      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database()",
   769      "v3-plan": {
   770        "QueryType": "SELECT",
   771        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database()",
   772        "Instructions": {
   773          "OperatorType": "Route",
   774          "Variant": "DBA",
   775          "Keyspace": {
   776            "Name": "main",
   777            "Sharded": false
   778          },
   779          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   780          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = database()",
   781          "Table": "INFORMATION_SCHEMA.`TABLES`"
   782        }
   783      },
   784      "gen4-plan": {
   785        "QueryType": "SELECT",
   786        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database()",
   787        "Instructions": {
   788          "OperatorType": "Route",
   789          "Variant": "DBA",
   790          "Keyspace": {
   791            "Name": "main",
   792            "Sharded": false
   793          },
   794          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   795          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = database()",
   796          "Table": "INFORMATION_SCHEMA.`TABLES`"
   797        }
   798      }
   799    },
   800    {
   801      "comment": "table_schema predicate the wrong way around",
   802      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 'ks' = TABLE_SCHEMA",
   803      "v3-plan": {
   804        "QueryType": "SELECT",
   805        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 'ks' = TABLE_SCHEMA",
   806        "Instructions": {
   807          "OperatorType": "Route",
   808          "Variant": "DBA",
   809          "Keyspace": {
   810            "Name": "main",
   811            "Sharded": false
   812          },
   813          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   814          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname",
   815          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   816          "Table": "INFORMATION_SCHEMA.`TABLES`"
   817        }
   818      },
   819      "gen4-plan": {
   820        "QueryType": "SELECT",
   821        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 'ks' = TABLE_SCHEMA",
   822        "Instructions": {
   823          "OperatorType": "Route",
   824          "Variant": "DBA",
   825          "Keyspace": {
   826            "Name": "main",
   827            "Sharded": false
   828          },
   829          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   830          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname",
   831          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   832          "Table": "INFORMATION_SCHEMA.`TABLES`"
   833        }
   834      }
   835    },
   836    {
   837      "comment": "table_name predicate against a routed table",
   838      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' AND TABLE_NAME = 'route1'",
   839      "v3-plan": {
   840        "QueryType": "SELECT",
   841        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' AND TABLE_NAME = 'route1'",
   842        "Instructions": {
   843          "OperatorType": "Route",
   844          "Variant": "DBA",
   845          "Keyspace": {
   846            "Name": "main",
   847            "Sharded": false
   848          },
   849          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   850          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname and TABLE_NAME = :TABLE_NAME",
   851          "SysTableTableName": "[TABLE_NAME:VARCHAR(\"route1\")]",
   852          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   853          "Table": "INFORMATION_SCHEMA.`TABLES`"
   854        }
   855      },
   856      "gen4-plan": {
   857        "QueryType": "SELECT",
   858        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' AND TABLE_NAME = 'route1'",
   859        "Instructions": {
   860          "OperatorType": "Route",
   861          "Variant": "DBA",
   862          "Keyspace": {
   863            "Name": "main",
   864            "Sharded": false
   865          },
   866          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   867          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname and TABLE_NAME = :TABLE_NAME",
   868          "SysTableTableName": "[TABLE_NAME:VARCHAR(\"route1\")]",
   869          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   870          "Table": "INFORMATION_SCHEMA.`TABLES`"
   871        }
   872      }
   873    },
   874    {
   875      "comment": "information_schema query with additional predicates",
   876      "query": "SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' and DATA_FREE = 42",
   877      "plan": {
   878        "QueryType": "SELECT",
   879        "Original": "SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' and DATA_FREE = 42",
   880        "Instructions": {
   881          "OperatorType": "Route",
   882          "Variant": "DBA",
   883          "Keyspace": {
   884            "Name": "main",
   885            "Sharded": false
   886          },
   887          "FieldQuery": "select TABLE_NAME from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   888          "Query": "select TABLE_NAME from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname and DATA_FREE = 42",
   889          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   890          "Table": "INFORMATION_SCHEMA.`TABLES`"
   891        }
   892      }
   893    },
   894    {
   895      "comment": "able to isolate table_schema value even when hidden inside of ORs",
   896      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_SCHEMA = 'ks' and DATA_FREE = 42) OR (TABLE_SCHEMA = 'ks' and CHECKSUM = 'value')",
   897      "v3-plan": {
   898        "QueryType": "SELECT",
   899        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_SCHEMA = 'ks' and DATA_FREE = 42) OR (TABLE_SCHEMA = 'ks' and CHECKSUM = 'value')",
   900        "Instructions": {
   901          "OperatorType": "Route",
   902          "Variant": "DBA",
   903          "Keyspace": {
   904            "Name": "main",
   905            "Sharded": false
   906          },
   907          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   908          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname and (DATA_FREE = 42 or `CHECKSUM` = 'value')",
   909          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   910          "Table": "INFORMATION_SCHEMA.`TABLES`"
   911        }
   912      },
   913      "gen4-plan": {
   914        "QueryType": "SELECT",
   915        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_SCHEMA = 'ks' and DATA_FREE = 42) OR (TABLE_SCHEMA = 'ks' and CHECKSUM = 'value')",
   916        "Instructions": {
   917          "OperatorType": "Route",
   918          "Variant": "DBA",
   919          "Keyspace": {
   920            "Name": "main",
   921            "Sharded": false
   922          },
   923          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
   924          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = :__vtschemaname and (DATA_FREE = 42 or `CHECKSUM` = 'value')",
   925          "SysTableTableSchema": "[VARCHAR(\"ks\")]",
   926          "Table": "INFORMATION_SCHEMA.`TABLES`"
   927        }
   928      }
   929    },
   930    {
   931      "comment": "expand star with information schema",
   932      "query": "select x.table_name from (select a.* from information_schema.key_column_usage a) x",
   933      "v3-plan": {
   934        "QueryType": "SELECT",
   935        "Original": "select x.table_name from (select a.* from information_schema.key_column_usage a) x",
   936        "Instructions": {
   937          "OperatorType": "Route",
   938          "Variant": "DBA",
   939          "Keyspace": {
   940            "Name": "main",
   941            "Sharded": false
   942          },
   943          "FieldQuery": "select x.table_name from (select a.* from information_schema.key_column_usage as a where 1 != 1) as x where 1 != 1",
   944          "Query": "select x.table_name from (select a.* from information_schema.key_column_usage as a) as x",
   945          "Table": "information_schema.key_column_usage"
   946        }
   947      },
   948      "gen4-plan": {
   949        "QueryType": "SELECT",
   950        "Original": "select x.table_name from (select a.* from information_schema.key_column_usage a) x",
   951        "Instructions": {
   952          "OperatorType": "Route",
   953          "Variant": "DBA",
   954          "Keyspace": {
   955            "Name": "main",
   956            "Sharded": false
   957          },
   958          "FieldQuery": "select x.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a where 1 != 1) as x where 1 != 1",
   959          "Query": "select x.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a) as x",
   960          "Table": "information_schema.key_column_usage"
   961        }
   962      }
   963    },
   964    {
   965      "comment": "expand star with information schema in a derived table",
   966      "query": "select x.table_name from (select a.* from information_schema.key_column_usage a) x join user on x.`COLUMN_NAME` = user.id",
   967      "v3-plan": {
   968        "QueryType": "SELECT",
   969        "Original": "select x.table_name from (select a.* from information_schema.key_column_usage a) x join user on x.`COLUMN_NAME` = user.id",
   970        "Instructions": {
   971          "OperatorType": "Join",
   972          "Variant": "Join",
   973          "JoinColumnIndexes": "L:0",
   974          "JoinVars": {
   975            "x_COLUMN_NAME": 1
   976          },
   977          "TableName": "information_schema.key_column_usage_`user`",
   978          "Inputs": [
   979            {
   980              "OperatorType": "Route",
   981              "Variant": "DBA",
   982              "Keyspace": {
   983                "Name": "main",
   984                "Sharded": false
   985              },
   986              "FieldQuery": "select x.table_name, x.COLUMN_NAME from (select a.* from information_schema.key_column_usage as a where 1 != 1) as x where 1 != 1",
   987              "Query": "select x.table_name, x.COLUMN_NAME from (select a.* from information_schema.key_column_usage as a) as x",
   988              "Table": "information_schema.key_column_usage"
   989            },
   990            {
   991              "OperatorType": "Route",
   992              "Variant": "EqualUnique",
   993              "Keyspace": {
   994                "Name": "user",
   995                "Sharded": true
   996              },
   997              "FieldQuery": "select 1 from `user` where 1 != 1",
   998              "Query": "select 1 from `user` where `user`.id = :x_COLUMN_NAME",
   999              "Table": "`user`",
  1000              "Values": [
  1001                ":x_COLUMN_NAME"
  1002              ],
  1003              "Vindex": "user_index"
  1004            }
  1005          ]
  1006        }
  1007      },
  1008      "gen4-plan": {
  1009        "QueryType": "SELECT",
  1010        "Original": "select x.table_name from (select a.* from information_schema.key_column_usage a) x join user on x.`COLUMN_NAME` = user.id",
  1011        "Instructions": {
  1012          "OperatorType": "Join",
  1013          "Variant": "Join",
  1014          "JoinColumnIndexes": "L:1",
  1015          "JoinVars": {
  1016            "x_COLUMN_NAME": 0
  1017          },
  1018          "TableName": "information_schema.key_column_usage_`user`",
  1019          "Inputs": [
  1020            {
  1021              "OperatorType": "Route",
  1022              "Variant": "DBA",
  1023              "Keyspace": {
  1024                "Name": "main",
  1025                "Sharded": false
  1026              },
  1027              "FieldQuery": "select x.COLUMN_NAME, x.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a where 1 != 1) as x where 1 != 1",
  1028              "Query": "select x.COLUMN_NAME, x.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a) as x",
  1029              "Table": "information_schema.key_column_usage"
  1030            },
  1031            {
  1032              "OperatorType": "Route",
  1033              "Variant": "EqualUnique",
  1034              "Keyspace": {
  1035                "Name": "user",
  1036                "Sharded": true
  1037              },
  1038              "FieldQuery": "select 1 from `user` where 1 != 1",
  1039              "Query": "select 1 from `user` where `user`.id = :x_COLUMN_NAME",
  1040              "Table": "`user`",
  1041              "Values": [
  1042                ":x_COLUMN_NAME"
  1043              ],
  1044              "Vindex": "user_index"
  1045            }
  1046          ]
  1047        },
  1048        "TablesUsed": [
  1049          "user.user"
  1050        ]
  1051      }
  1052    },
  1053    {
  1054      "comment": "join of information_schema queries with select stars exprs",
  1055      "query": "select a.*, b.* from information_schema.GLOBAL_STATUS a, information_schema.CHARACTER_SETS b",
  1056      "v3-plan": {
  1057        "QueryType": "SELECT",
  1058        "Original": "select a.*, b.* from information_schema.GLOBAL_STATUS a, information_schema.CHARACTER_SETS b",
  1059        "Instructions": {
  1060          "OperatorType": "Route",
  1061          "Variant": "DBA",
  1062          "Keyspace": {
  1063            "Name": "main",
  1064            "Sharded": false
  1065          },
  1066          "FieldQuery": "select a.*, b.* from information_schema.GLOBAL_STATUS as a, information_schema.CHARACTER_SETS as b where 1 != 1",
  1067          "Query": "select a.*, b.* from information_schema.GLOBAL_STATUS as a, information_schema.CHARACTER_SETS as b",
  1068          "Table": "information_schema.GLOBAL_STATUS, information_schema.CHARACTER_SETS"
  1069        }
  1070      },
  1071      "gen4-plan": {
  1072        "QueryType": "SELECT",
  1073        "Original": "select a.*, b.* from information_schema.GLOBAL_STATUS a, information_schema.CHARACTER_SETS b",
  1074        "Instructions": {
  1075          "OperatorType": "Route",
  1076          "Variant": "DBA",
  1077          "Keyspace": {
  1078            "Name": "main",
  1079            "Sharded": false
  1080          },
  1081          "FieldQuery": "select a.VARIABLE_NAME as VARIABLE_NAME, a.VARIABLE_VALUE as VARIABLE_VALUE, b.CHARACTER_SET_NAME as CHARACTER_SET_NAME, b.DEFAULT_COLLATE_NAME as DEFAULT_COLLATE_NAME, b.DESCRIPTION as DESCRIPTION, b.MAXLEN as MAXLEN from information_schema.GLOBAL_STATUS as a, information_schema.CHARACTER_SETS as b where 1 != 1",
  1082          "Query": "select a.VARIABLE_NAME as VARIABLE_NAME, a.VARIABLE_VALUE as VARIABLE_VALUE, b.CHARACTER_SET_NAME as CHARACTER_SET_NAME, b.DEFAULT_COLLATE_NAME as DEFAULT_COLLATE_NAME, b.DESCRIPTION as DESCRIPTION, b.MAXLEN as MAXLEN from information_schema.GLOBAL_STATUS as a, information_schema.CHARACTER_SETS as b",
  1083          "Table": "information_schema.CHARACTER_SETS, information_schema.GLOBAL_STATUS"
  1084        }
  1085      }
  1086    },
  1087    {
  1088      "comment": "join two routes with SysTableTableName entries in LHS and RHS",
  1089      "query": "select a.table_name from (select * from information_schema.key_column_usage a where a.table_name = 'users') a join (select * from information_schema.referential_constraints where table_name = 'users') b",
  1090      "v3-plan": {
  1091        "QueryType": "SELECT",
  1092        "Original": "select a.table_name from (select * from information_schema.key_column_usage a where a.table_name = 'users') a join (select * from information_schema.referential_constraints where table_name = 'users') b",
  1093        "Instructions": {
  1094          "OperatorType": "Route",
  1095          "Variant": "DBA",
  1096          "Keyspace": {
  1097            "Name": "main",
  1098            "Sharded": false
  1099          },
  1100          "FieldQuery": "select a.table_name from (select * from information_schema.key_column_usage as a where 1 != 1) as a join (select * from information_schema.referential_constraints where 1 != 1) as b where 1 != 1",
  1101          "Query": "select a.table_name from (select * from information_schema.key_column_usage as a where a.table_name = :a_table_name) as a join (select * from information_schema.referential_constraints where table_name = :table_name) as b",
  1102          "SysTableTableName": "[a_table_name:VARCHAR(\"users\"), table_name:VARCHAR(\"users\")]",
  1103          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
  1104        }
  1105      },
  1106      "gen4-plan": {
  1107        "QueryType": "SELECT",
  1108        "Original": "select a.table_name from (select * from information_schema.key_column_usage a where a.table_name = 'users') a join (select * from information_schema.referential_constraints where table_name = 'users') b",
  1109        "Instructions": {
  1110          "OperatorType": "Route",
  1111          "Variant": "DBA",
  1112          "Keyspace": {
  1113            "Name": "main",
  1114            "Sharded": false
  1115          },
  1116          "FieldQuery": "select a.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a where 1 != 1) as a, (select CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, UNIQUE_CONSTRAINT_CATALOG, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, MATCH_OPTION, UPDATE_RULE, DELETE_RULE, TABLE_NAME, REFERENCED_TABLE_NAME from information_schema.referential_constraints where 1 != 1) as b where 1 != 1",
  1117          "Query": "select a.table_name from (select a.CONSTRAINT_CATALOG, a.CONSTRAINT_SCHEMA, a.CONSTRAINT_NAME, a.TABLE_CATALOG, a.TABLE_SCHEMA, a.TABLE_NAME, a.COLUMN_NAME, a.ORDINAL_POSITION, a.POSITION_IN_UNIQUE_CONSTRAINT, a.REFERENCED_TABLE_SCHEMA, a.REFERENCED_TABLE_NAME, a.REFERENCED_COLUMN_NAME from information_schema.key_column_usage as a where a.table_name = :a_table_name) as a, (select CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, UNIQUE_CONSTRAINT_CATALOG, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, MATCH_OPTION, UPDATE_RULE, DELETE_RULE, TABLE_NAME, REFERENCED_TABLE_NAME from information_schema.referential_constraints where table_name = :table_name) as b",
  1118          "SysTableTableName": "[a_table_name:VARCHAR(\"users\"), table_name:VARCHAR(\"users\")]",
  1119          "Table": "information_schema.key_column_usage, information_schema.referential_constraints"
  1120        }
  1121      }
  1122    },
  1123    {
  1124      "comment": "select sum(found) from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1125      "query": "select sum(found) from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1126      "v3-plan": "VT12001: unsupported: cross-shard query with aggregates",
  1127      "gen4-plan": {
  1128        "QueryType": "SELECT",
  1129        "Original": "select sum(found) from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1130        "Instructions": {
  1131          "OperatorType": "Route",
  1132          "Variant": "DBA",
  1133          "Keyspace": {
  1134            "Name": "main",
  1135            "Sharded": false
  1136          },
  1137          "FieldQuery": "select sum(found) from (select 1 as found from information_schema.`tables` where 1 != 1 union all (select 1 as found from information_schema.views where 1 != 1)) as t where 1 != 1",
  1138          "Query": "select sum(found) from (select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname union all (select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1)) as t",
  1139          "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"music\")]",
  1140          "Table": "information_schema.`tables`"
  1141        }
  1142      }
  1143    },
  1144    {
  1145      "comment": "union as a derived table",
  1146      "query": "select found from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1147      "v3-plan": {
  1148        "QueryType": "SELECT",
  1149        "Original": "select found from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1150        "Instructions": {
  1151          "OperatorType": "SimpleProjection",
  1152          "Columns": [
  1153            0
  1154          ],
  1155          "Inputs": [
  1156            {
  1157              "OperatorType": "Concatenate",
  1158              "Inputs": [
  1159                {
  1160                  "OperatorType": "Route",
  1161                  "Variant": "DBA",
  1162                  "Keyspace": {
  1163                    "Name": "main",
  1164                    "Sharded": false
  1165                  },
  1166                  "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1167                  "Query": "select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname",
  1168                  "SysTableTableSchema": "[VARCHAR(\"music\")]",
  1169                  "Table": "information_schema.`tables`"
  1170                },
  1171                {
  1172                  "OperatorType": "Route",
  1173                  "Variant": "DBA",
  1174                  "Keyspace": {
  1175                    "Name": "main",
  1176                    "Sharded": false
  1177                  },
  1178                  "FieldQuery": "select 1 as found from information_schema.views where 1 != 1",
  1179                  "Query": "select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1",
  1180                  "SysTableTableSchema": "[VARCHAR(\"music\")]",
  1181                  "Table": "information_schema.views"
  1182                }
  1183              ]
  1184            }
  1185          ]
  1186        }
  1187      },
  1188      "gen4-plan": {
  1189        "QueryType": "SELECT",
  1190        "Original": "select found from (select 1 as found from information_schema.`tables` where table_schema = 'music' union all (select 1 as found from information_schema.views where table_schema = 'music' limit 1)) as t",
  1191        "Instructions": {
  1192          "OperatorType": "Route",
  1193          "Variant": "DBA",
  1194          "Keyspace": {
  1195            "Name": "main",
  1196            "Sharded": false
  1197          },
  1198          "FieldQuery": "select found from (select 1 as found from information_schema.`tables` where 1 != 1 union all (select 1 as found from information_schema.views where 1 != 1)) as t where 1 != 1",
  1199          "Query": "select found from (select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname union all (select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1)) as t",
  1200          "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"music\")]",
  1201          "Table": "information_schema.`tables`"
  1202        }
  1203      }
  1204    },
  1205    {
  1206      "comment": "merge system schema queries as long as they have any same table_schema",
  1207      "query": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1208      "v3-plan": {
  1209        "QueryType": "SELECT",
  1210        "Original": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1211        "Instructions": {
  1212          "OperatorType": "Concatenate",
  1213          "Inputs": [
  1214            {
  1215              "OperatorType": "Route",
  1216              "Variant": "DBA",
  1217              "Keyspace": {
  1218                "Name": "main",
  1219                "Sharded": false
  1220              },
  1221              "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1222              "Query": "select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname",
  1223              "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"Music\")]",
  1224              "Table": "information_schema.`tables`"
  1225            },
  1226            {
  1227              "OperatorType": "Route",
  1228              "Variant": "DBA",
  1229              "Keyspace": {
  1230                "Name": "main",
  1231                "Sharded": false
  1232              },
  1233              "FieldQuery": "select 1 as found from information_schema.views where 1 != 1",
  1234              "Query": "select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1",
  1235              "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"user\")]",
  1236              "Table": "information_schema.views"
  1237            }
  1238          ]
  1239        }
  1240      },
  1241      "gen4-plan": {
  1242        "QueryType": "SELECT",
  1243        "Original": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1244        "Instructions": {
  1245          "OperatorType": "Route",
  1246          "Variant": "DBA",
  1247          "Keyspace": {
  1248            "Name": "main",
  1249            "Sharded": false
  1250          },
  1251          "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1 union all (select 1 as found from information_schema.views where 1 != 1)",
  1252          "Query": "select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname union all (select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1)",
  1253          "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"Music\"), VARCHAR(\"music\"), VARCHAR(\"user\")]",
  1254          "Table": "information_schema.`tables`"
  1255        }
  1256      }
  1257    },
  1258    {
  1259      "comment": "merge system schema queries as long as they have any same table_name",
  1260      "query": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1261      "v3-plan": {
  1262        "QueryType": "SELECT",
  1263        "Original": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1264        "Instructions": {
  1265          "OperatorType": "Concatenate",
  1266          "Inputs": [
  1267            {
  1268              "OperatorType": "Route",
  1269              "Variant": "DBA",
  1270              "Keyspace": {
  1271                "Name": "main",
  1272                "Sharded": false
  1273              },
  1274              "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1275              "Query": "select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname",
  1276              "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"Music\")]",
  1277              "Table": "information_schema.`tables`"
  1278            },
  1279            {
  1280              "OperatorType": "Route",
  1281              "Variant": "DBA",
  1282              "Keyspace": {
  1283                "Name": "main",
  1284                "Sharded": false
  1285              },
  1286              "FieldQuery": "select 1 as found from information_schema.views where 1 != 1",
  1287              "Query": "select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1",
  1288              "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"user\")]",
  1289              "Table": "information_schema.views"
  1290            }
  1291          ]
  1292        }
  1293      },
  1294      "gen4-plan": {
  1295        "QueryType": "SELECT",
  1296        "Original": "select 1 as found from information_schema.`tables` where table_schema = 'music' and table_schema = 'Music' union all (select 1 as found from information_schema.views where table_schema = 'music' and table_schema = 'user' limit 1)",
  1297        "Instructions": {
  1298          "OperatorType": "Route",
  1299          "Variant": "DBA",
  1300          "Keyspace": {
  1301            "Name": "main",
  1302            "Sharded": false
  1303          },
  1304          "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1 union all (select 1 as found from information_schema.views where 1 != 1)",
  1305          "Query": "select 1 as found from information_schema.`tables` where table_schema = :__vtschemaname union all (select 1 as found from information_schema.views where table_schema = :__vtschemaname limit 1)",
  1306          "SysTableTableSchema": "[VARCHAR(\"music\"), VARCHAR(\"Music\"), VARCHAR(\"music\"), VARCHAR(\"user\")]",
  1307          "Table": "information_schema.`tables`"
  1308        }
  1309      }
  1310    },
  1311    {
  1312      "comment": "merge union subquery with outer query referencing the same system schemas",
  1313      "query": "select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' and exists (select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' union all (select 1 as found from information_schema.views where table_name = 'music' and table_name = 'user' limit 1))",
  1314      "v3-plan": {
  1315        "QueryType": "SELECT",
  1316        "Original": "select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' and exists (select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' union all (select 1 as found from information_schema.views where table_name = 'music' and table_name = 'user' limit 1))",
  1317        "Instructions": {
  1318          "OperatorType": "Subquery",
  1319          "Variant": "PulloutExists",
  1320          "PulloutVars": [
  1321            "__sq_has_values1",
  1322            "__sq1"
  1323          ],
  1324          "Inputs": [
  1325            {
  1326              "OperatorType": "Concatenate",
  1327              "Inputs": [
  1328                {
  1329                  "OperatorType": "Route",
  1330                  "Variant": "DBA",
  1331                  "Keyspace": {
  1332                    "Name": "main",
  1333                    "Sharded": false
  1334                  },
  1335                  "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1336                  "Query": "select 1 as found from information_schema.`tables` where table_name = :table_name2 and table_name = :table_name3",
  1337                  "SysTableTableName": "[table_name2:VARCHAR(\"music\"), table_name3:VARCHAR(\"Music\")]",
  1338                  "Table": "information_schema.`tables`"
  1339                },
  1340                {
  1341                  "OperatorType": "Route",
  1342                  "Variant": "DBA",
  1343                  "Keyspace": {
  1344                    "Name": "main",
  1345                    "Sharded": false
  1346                  },
  1347                  "FieldQuery": "select 1 as found from information_schema.views where 1 != 1",
  1348                  "Query": "select 1 as found from information_schema.views where table_name = :table_name4 and table_name = :table_name5 limit 1",
  1349                  "SysTableTableName": "[table_name4:VARCHAR(\"music\"), table_name5:VARCHAR(\"user\")]",
  1350                  "Table": "information_schema.views"
  1351                }
  1352              ]
  1353            },
  1354            {
  1355              "OperatorType": "Route",
  1356              "Variant": "DBA",
  1357              "Keyspace": {
  1358                "Name": "main",
  1359                "Sharded": false
  1360              },
  1361              "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1362              "Query": "select 1 as found from information_schema.`tables` where table_name = :table_name and table_name = :table_name1 and :__sq_has_values1",
  1363              "SysTableTableName": "[table_name1:VARCHAR(\"Music\"), table_name:VARCHAR(\"music\")]",
  1364              "Table": "information_schema.`tables`"
  1365            }
  1366          ]
  1367        }
  1368      },
  1369      "gen4-plan": {
  1370        "QueryType": "SELECT",
  1371        "Original": "select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' and exists (select 1 as found from information_schema.`tables` where table_name = 'music' and table_name = 'Music' union all (select 1 as found from information_schema.views where table_name = 'music' and table_name = 'user' limit 1))",
  1372        "Instructions": {
  1373          "OperatorType": "Route",
  1374          "Variant": "DBA",
  1375          "Keyspace": {
  1376            "Name": "main",
  1377            "Sharded": false
  1378          },
  1379          "FieldQuery": "select 1 as found from information_schema.`tables` where 1 != 1",
  1380          "Query": "select 1 as found from information_schema.`tables` where table_name = :table_name and table_name = :table_name1 and exists (select 1 as found from information_schema.`tables` where table_name = :table_name2 and table_name = :table_name3 union all (select 1 as found from information_schema.views where table_name = :table_name4 and table_name = :table_name5 limit 1))",
  1381          "SysTableTableName": "[table_name1:VARCHAR(\"Music\"), table_name2:VARCHAR(\"music\"), table_name3:VARCHAR(\"Music\"), table_name4:VARCHAR(\"music\"), table_name5:VARCHAR(\"user\"), table_name:VARCHAR(\"music\")]",
  1382          "Table": "information_schema.`tables`"
  1383        }
  1384      }
  1385    },
  1386    {
  1387      "comment": "merge even one side have schema name in derived table",
  1388      "query": "select * from (select TABLE_NAME from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select TABLE_NAME from information_schema.columns) dt",
  1389      "v3-plan": {
  1390        "QueryType": "SELECT",
  1391        "Original": "select * from (select TABLE_NAME from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select TABLE_NAME from information_schema.columns) dt",
  1392        "Instructions": {
  1393          "OperatorType": "SimpleProjection",
  1394          "Columns": [
  1395            0
  1396          ],
  1397          "Inputs": [
  1398            {
  1399              "OperatorType": "Distinct",
  1400              "Inputs": [
  1401                {
  1402                  "OperatorType": "Concatenate",
  1403                  "Inputs": [
  1404                    {
  1405                      "OperatorType": "Route",
  1406                      "Variant": "DBA",
  1407                      "Keyspace": {
  1408                        "Name": "main",
  1409                        "Sharded": false
  1410                      },
  1411                      "FieldQuery": "select TABLE_NAME from information_schema.`tables` as t where 1 != 1",
  1412                      "Query": "select TABLE_NAME from information_schema.`tables` as t where t.TABLE_SCHEMA = :__vtschemaname",
  1413                      "SysTableTableSchema": "[VARCHAR(\"a\")]",
  1414                      "Table": "information_schema.`tables`"
  1415                    },
  1416                    {
  1417                      "OperatorType": "Route",
  1418                      "Variant": "DBA",
  1419                      "Keyspace": {
  1420                        "Name": "main",
  1421                        "Sharded": false
  1422                      },
  1423                      "FieldQuery": "select TABLE_NAME from information_schema.`columns` where 1 != 1",
  1424                      "Query": "select TABLE_NAME from information_schema.`columns`",
  1425                      "Table": "information_schema.`columns`"
  1426                    }
  1427                  ]
  1428                }
  1429              ]
  1430            }
  1431          ]
  1432        }
  1433      },
  1434      "gen4-plan": {
  1435        "QueryType": "SELECT",
  1436        "Original": "select * from (select TABLE_NAME from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select TABLE_NAME from information_schema.columns) dt",
  1437        "Instructions": {
  1438          "OperatorType": "Route",
  1439          "Variant": "DBA",
  1440          "Keyspace": {
  1441            "Name": "main",
  1442            "Sharded": false
  1443          },
  1444          "FieldQuery": "select dt.TABLE_NAME from (select TABLE_NAME from information_schema.`tables` as t where 1 != 1 union select TABLE_NAME from information_schema.`columns` where 1 != 1) as dt where 1 != 1",
  1445          "Query": "select dt.TABLE_NAME from (select TABLE_NAME from information_schema.`tables` as t where t.TABLE_SCHEMA = :__vtschemaname union select TABLE_NAME from information_schema.`columns`) as dt",
  1446          "SysTableTableSchema": "[VARCHAR(\"a\")]",
  1447          "Table": "information_schema.`tables`"
  1448        }
  1449      }
  1450    },
  1451    {
  1452      "comment": "merge even one side have schema name in subquery",
  1453      "query": "select `COLLATION_NAME` from information_schema.`COLUMNS` t where `COLUMN_NAME` in (select `COLUMN_NAME` from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select `COLUMN_NAME` from information_schema.columns)",
  1454      "v3-plan": {
  1455        "QueryType": "SELECT",
  1456        "Original": "select `COLLATION_NAME` from information_schema.`COLUMNS` t where `COLUMN_NAME` in (select `COLUMN_NAME` from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select `COLUMN_NAME` from information_schema.columns)",
  1457        "Instructions": {
  1458          "OperatorType": "Subquery",
  1459          "Variant": "PulloutIn",
  1460          "PulloutVars": [
  1461            "__sq_has_values1",
  1462            "__sq1"
  1463          ],
  1464          "Inputs": [
  1465            {
  1466              "OperatorType": "Distinct",
  1467              "Inputs": [
  1468                {
  1469                  "OperatorType": "Concatenate",
  1470                  "Inputs": [
  1471                    {
  1472                      "OperatorType": "Route",
  1473                      "Variant": "DBA",
  1474                      "Keyspace": {
  1475                        "Name": "main",
  1476                        "Sharded": false
  1477                      },
  1478                      "FieldQuery": "select COLUMN_NAME from information_schema.`tables` as t where 1 != 1",
  1479                      "Query": "select COLUMN_NAME from information_schema.`tables` as t where t.TABLE_SCHEMA = :__vtschemaname",
  1480                      "SysTableTableSchema": "[VARCHAR(\"a\")]",
  1481                      "Table": "information_schema.`tables`"
  1482                    },
  1483                    {
  1484                      "OperatorType": "Route",
  1485                      "Variant": "DBA",
  1486                      "Keyspace": {
  1487                        "Name": "main",
  1488                        "Sharded": false
  1489                      },
  1490                      "FieldQuery": "select COLUMN_NAME from information_schema.`columns` where 1 != 1",
  1491                      "Query": "select COLUMN_NAME from information_schema.`columns`",
  1492                      "Table": "information_schema.`columns`"
  1493                    }
  1494                  ]
  1495                }
  1496              ]
  1497            },
  1498            {
  1499              "OperatorType": "Route",
  1500              "Variant": "DBA",
  1501              "Keyspace": {
  1502                "Name": "main",
  1503                "Sharded": false
  1504              },
  1505              "FieldQuery": "select COLLATION_NAME from information_schema.`COLUMNS` as t where 1 != 1",
  1506              "Query": "select COLLATION_NAME from information_schema.`COLUMNS` as t where :__sq_has_values1 = 1 and COLUMN_NAME in ::__sq1",
  1507              "Table": "information_schema.`COLUMNS`"
  1508            }
  1509          ]
  1510        }
  1511      },
  1512      "gen4-plan": {
  1513        "QueryType": "SELECT",
  1514        "Original": "select `COLLATION_NAME` from information_schema.`COLUMNS` t where `COLUMN_NAME` in (select `COLUMN_NAME` from information_schema.tables t where t.TABLE_SCHEMA = 'a' union select `COLUMN_NAME` from information_schema.columns)",
  1515        "Instructions": {
  1516          "OperatorType": "Route",
  1517          "Variant": "DBA",
  1518          "Keyspace": {
  1519            "Name": "main",
  1520            "Sharded": false
  1521          },
  1522          "FieldQuery": "select COLLATION_NAME from information_schema.`COLUMNS` as t where 1 != 1",
  1523          "Query": "select COLLATION_NAME from information_schema.`COLUMNS` as t where COLUMN_NAME in (select COLUMN_NAME from information_schema.`tables` as t where t.TABLE_SCHEMA = :__vtschemaname union select COLUMN_NAME from information_schema.`columns`)",
  1524          "SysTableTableSchema": "[VARCHAR(\"a\")]",
  1525          "Table": "information_schema.`COLUMNS`"
  1526        }
  1527      }
  1528    },
  1529    {
  1530      "comment": "table_schema OR predicate\n# It is unsupported because we do not route queries to multiple keyspaces right now",
  1531      "query": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' OR TABLE_SCHEMA = 'main'",
  1532      "v3-plan": {
  1533        "QueryType": "SELECT",
  1534        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' OR TABLE_SCHEMA = 'main'",
  1535        "Instructions": {
  1536          "OperatorType": "Route",
  1537          "Variant": "DBA",
  1538          "Keyspace": {
  1539            "Name": "main",
  1540            "Sharded": false
  1541          },
  1542          "FieldQuery": "select * from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
  1543          "Query": "select * from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = 'ks' or TABLE_SCHEMA = 'main'",
  1544          "Table": "INFORMATION_SCHEMA.`TABLES`"
  1545        }
  1546      },
  1547      "gen4-plan": {
  1548        "QueryType": "SELECT",
  1549        "Original": "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ks' OR TABLE_SCHEMA = 'main'",
  1550        "Instructions": {
  1551          "OperatorType": "Route",
  1552          "Variant": "DBA",
  1553          "Keyspace": {
  1554            "Name": "main",
  1555            "Sharded": false
  1556          },
  1557          "FieldQuery": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where 1 != 1",
  1558          "Query": "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, `ENGINE`, VERSION, `ROW_FORMAT`, TABLE_ROWS, `AVG_ROW_LENGTH`, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, DATA_FREE, `AUTO_INCREMENT`, CREATE_TIME, UPDATE_TIME, CHECK_TIME, TABLE_COLLATION, `CHECKSUM`, CREATE_OPTIONS, TABLE_COMMENT from INFORMATION_SCHEMA.`TABLES` where TABLE_SCHEMA = 'ks' or TABLE_SCHEMA = 'main'",
  1559          "Table": "INFORMATION_SCHEMA.`TABLES`"
  1560        }
  1561      }
  1562    },
  1563    {
  1564      "comment": "Non-existing information_schema table is still OK",
  1565      "query": "select TABLE_NAME from information_schema.apa",
  1566      "plan": {
  1567        "QueryType": "SELECT",
  1568        "Original": "select TABLE_NAME from information_schema.apa",
  1569        "Instructions": {
  1570          "OperatorType": "Route",
  1571          "Variant": "DBA",
  1572          "Keyspace": {
  1573            "Name": "main",
  1574            "Sharded": false
  1575          },
  1576          "FieldQuery": "select TABLE_NAME from information_schema.apa where 1 != 1",
  1577          "Query": "select TABLE_NAME from information_schema.apa",
  1578          "Table": "information_schema.apa"
  1579        }
  1580      }
  1581    }
  1582  ]