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

     1  [
     2    {
     3      "comment": "Show table status without database name or conditions.",
     4      "query": "SHOW table StatUs",
     5      "plan": {
     6        "QueryType": "SHOW",
     7        "Original": "SHOW table StatUs",
     8        "Instructions": {
     9          "OperatorType": "Send",
    10          "Keyspace": {
    11            "Name": "main",
    12            "Sharded": false
    13          },
    14          "TargetDestination": "AnyShard()",
    15          "Query": "show table status",
    16          "SingleShardOnly": true
    17        }
    18      }
    19    },
    20    {
    21      "comment": "Show Table status with a keyspace name",
    22      "query": "SHOW table StatUs from main",
    23      "plan": {
    24        "QueryType": "SHOW",
    25        "Original": "SHOW table StatUs from main",
    26        "Instructions": {
    27          "OperatorType": "Send",
    28          "Keyspace": {
    29            "Name": "main",
    30            "Sharded": false
    31          },
    32          "TargetDestination": "AnyShard()",
    33          "Query": "show table status",
    34          "SingleShardOnly": true
    35        }
    36      }
    37    },
    38    {
    39      "comment": "Show Table status with a keyspace name using IN",
    40      "query": "SHOW table StatUs In main",
    41      "plan": {
    42        "QueryType": "SHOW",
    43        "Original": "SHOW table StatUs In main",
    44        "Instructions": {
    45          "OperatorType": "Send",
    46          "Keyspace": {
    47            "Name": "main",
    48            "Sharded": false
    49          },
    50          "TargetDestination": "AnyShard()",
    51          "Query": "show table status",
    52          "SingleShardOnly": true
    53        }
    54      }
    55    },
    56    {
    57      "comment": "Show Table status with a keyspace name with a condition",
    58      "query": "SHOW table StatUs In user WHERE `Rows` > 70",
    59      "plan": {
    60        "QueryType": "SHOW",
    61        "Original": "SHOW table StatUs In user WHERE `Rows` > 70",
    62        "Instructions": {
    63          "OperatorType": "Send",
    64          "Keyspace": {
    65            "Name": "user",
    66            "Sharded": true
    67          },
    68          "TargetDestination": "AnyShard()",
    69          "Query": "show table status where `Rows` > 70",
    70          "SingleShardOnly": true
    71        }
    72      }
    73    },
    74    {
    75      "comment": "Show Table status with a Like condition",
    76      "query": "SHOW table StatUs LIKe '%a'",
    77      "plan": {
    78        "QueryType": "SHOW",
    79        "Original": "SHOW table StatUs LIKe '%a'",
    80        "Instructions": {
    81          "OperatorType": "Send",
    82          "Keyspace": {
    83            "Name": "main",
    84            "Sharded": false
    85          },
    86          "TargetDestination": "AnyShard()",
    87          "Query": "show table status like '%a'",
    88          "SingleShardOnly": true
    89        }
    90      }
    91    },
    92    {
    93      "comment": "show columns from user keyspace",
    94      "query": "show full columns from user.user_extra",
    95      "plan": {
    96        "QueryType": "SHOW",
    97        "Original": "show full columns from user.user_extra",
    98        "Instructions": {
    99          "OperatorType": "Send",
   100          "Keyspace": {
   101            "Name": "user",
   102            "Sharded": true
   103          },
   104          "TargetDestination": "AnyShard()",
   105          "Query": "show full columns from user_extra",
   106          "SingleShardOnly": true
   107        }
   108      }
   109    },
   110    {
   111      "comment": "show columns from main keyspace",
   112      "query": "show full columns from unsharded",
   113      "plan": {
   114        "QueryType": "SHOW",
   115        "Original": "show full columns from unsharded",
   116        "Instructions": {
   117          "OperatorType": "Send",
   118          "Keyspace": {
   119            "Name": "main",
   120            "Sharded": false
   121          },
   122          "TargetDestination": "AnyShard()",
   123          "Query": "show full columns from unsharded",
   124          "SingleShardOnly": true
   125        }
   126      }
   127    },
   128    {
   129      "comment": "show columns pass as dbname in from clause supersedes the qualifier",
   130      "query": "show full columns from user.unsharded from main",
   131      "plan": {
   132        "QueryType": "SHOW",
   133        "Original": "show full columns from user.unsharded from main",
   134        "Instructions": {
   135          "OperatorType": "Send",
   136          "Keyspace": {
   137            "Name": "main",
   138            "Sharded": false
   139          },
   140          "TargetDestination": "AnyShard()",
   141          "Query": "show full columns from unsharded",
   142          "SingleShardOnly": true
   143        }
   144      }
   145    },
   146    {
   147      "comment": "show columns fails as table does not exists in user keyspace",
   148      "query": "show full columns from unsharded from user",
   149      "plan": "table unsharded not found"
   150    },
   151    {
   152      "comment": "show columns fails as table does not exists in user keyspace",
   153      "query": "show full columns from user.unsharded",
   154      "plan": "table unsharded not found"
   155    },
   156    {
   157      "comment": "show charset",
   158      "query": "show charset",
   159      "plan": {
   160        "QueryType": "SHOW",
   161        "Original": "show charset",
   162        "Instructions": {
   163          "OperatorType": "Rows",
   164          "Fields": {
   165            "Charset": "VARCHAR",
   166            "Default collation": "VARCHAR",
   167            "Description": "VARCHAR",
   168            "Maxlen": "INT32"
   169          },
   170          "RowCount": 2
   171        }
   172      }
   173    },
   174    {
   175      "comment": "show function",
   176      "query": "show function status",
   177      "plan": {
   178        "QueryType": "SHOW",
   179        "Original": "show function status",
   180        "Instructions": {
   181          "OperatorType": "Send",
   182          "Keyspace": {
   183            "Name": "main",
   184            "Sharded": false
   185          },
   186          "TargetDestination": "AnyShard()",
   187          "Query": "show function status",
   188          "SingleShardOnly": true
   189        }
   190      }
   191    },
   192    {
   193      "comment": "show privileges",
   194      "query": "show privileges",
   195      "plan": {
   196        "QueryType": "SHOW",
   197        "Original": "show privileges",
   198        "Instructions": {
   199          "OperatorType": "Send",
   200          "Keyspace": {
   201            "Name": "main",
   202            "Sharded": false
   203          },
   204          "TargetDestination": "AnyShard()",
   205          "Query": "show privileges",
   206          "SingleShardOnly": true
   207        }
   208      }
   209    },
   210    {
   211      "comment": "show procedure status",
   212      "query": "show procedure status",
   213      "plan": {
   214        "QueryType": "SHOW",
   215        "Original": "show procedure status",
   216        "Instructions": {
   217          "OperatorType": "Send",
   218          "Keyspace": {
   219            "Name": "main",
   220            "Sharded": false
   221          },
   222          "TargetDestination": "AnyShard()",
   223          "Query": "show procedure status",
   224          "SingleShardOnly": true
   225        }
   226      }
   227    },
   228    {
   229      "comment": "show variables",
   230      "query": "show variables",
   231      "plan": {
   232        "QueryType": "SHOW",
   233        "Original": "show variables",
   234        "Instructions": {
   235          "OperatorType": "ReplaceVariables",
   236          "Inputs": [
   237            {
   238              "OperatorType": "Send",
   239              "Keyspace": {
   240                "Name": "main",
   241                "Sharded": false
   242              },
   243              "TargetDestination": "AnyShard()",
   244              "Query": "show variables",
   245              "SingleShardOnly": true
   246            }
   247          ]
   248        }
   249      }
   250    },
   251    {
   252      "comment": "show global variables",
   253      "query": "show global variables",
   254      "plan": {
   255        "QueryType": "SHOW",
   256        "Original": "show global variables",
   257        "Instructions": {
   258          "OperatorType": "ReplaceVariables",
   259          "Inputs": [
   260            {
   261              "OperatorType": "Send",
   262              "Keyspace": {
   263                "Name": "main",
   264                "Sharded": false
   265              },
   266              "TargetDestination": "AnyShard()",
   267              "Query": "show global variables",
   268              "SingleShardOnly": true
   269            }
   270          ]
   271        }
   272      }
   273    },
   274    {
   275      "comment": "show databases",
   276      "query": "show databases",
   277      "plan": {
   278        "QueryType": "SHOW",
   279        "Original": "show databases",
   280        "Instructions": {
   281          "OperatorType": "Rows",
   282          "Fields": {
   283            "Database": "VARCHAR"
   284          },
   285          "RowCount": 5
   286        }
   287      }
   288    },
   289    {
   290      "comment": "show create database",
   291      "query": "show create database user",
   292      "plan": {
   293        "QueryType": "SHOW",
   294        "Original": "show create database user",
   295        "Instructions": {
   296          "OperatorType": "Send",
   297          "Keyspace": {
   298            "Name": "user",
   299            "Sharded": true
   300          },
   301          "TargetDestination": "AnyShard()",
   302          "Query": "show create database `user`",
   303          "SingleShardOnly": true
   304        }
   305      }
   306    },
   307    {
   308      "comment": "show create database system_schema",
   309      "query": "show create database mysql",
   310      "plan": {
   311        "QueryType": "SHOW",
   312        "Original": "show create database mysql",
   313        "Instructions": {
   314          "OperatorType": "Send",
   315          "Keyspace": {
   316            "Name": "main",
   317            "Sharded": false
   318          },
   319          "TargetDestination": "AnyShard()",
   320          "Query": "show create database mysql",
   321          "SingleShardOnly": true
   322        }
   323      }
   324    },
   325    {
   326      "comment": "show create procedure",
   327      "query": "show create procedure proc",
   328      "plan": {
   329        "QueryType": "SHOW",
   330        "Original": "show create procedure proc",
   331        "Instructions": {
   332          "OperatorType": "Send",
   333          "Keyspace": {
   334            "Name": "main",
   335            "Sharded": false
   336          },
   337          "TargetDestination": "AnyShard()",
   338          "Query": "show create procedure proc",
   339          "SingleShardOnly": true
   340        }
   341      }
   342    },
   343    {
   344      "comment": "show create procedure from system_schema",
   345      "query": "show create procedure information_schema.proc",
   346      "plan": {
   347        "QueryType": "SHOW",
   348        "Original": "show create procedure information_schema.proc",
   349        "Instructions": {
   350          "OperatorType": "Send",
   351          "Keyspace": {
   352            "Name": "main",
   353            "Sharded": false
   354          },
   355          "TargetDestination": "AnyShard()",
   356          "Query": "show create procedure information_schema.proc",
   357          "SingleShardOnly": true
   358        }
   359      }
   360    },
   361    {
   362      "comment": "show create table on table present in sharded but as unsharded is selected it goes to unsharded keyspace",
   363      "query": "show create table user_extra",
   364      "plan": {
   365        "QueryType": "SHOW",
   366        "Original": "show create table user_extra",
   367        "Instructions": {
   368          "OperatorType": "Send",
   369          "Keyspace": {
   370            "Name": "main",
   371            "Sharded": false
   372          },
   373          "TargetDestination": "AnyShard()",
   374          "Query": "show create table user_extra",
   375          "SingleShardOnly": true
   376        }
   377      }
   378    },
   379    {
   380      "comment": "show create table with qualifier",
   381      "query": "show create table user.user_extra",
   382      "plan": {
   383        "QueryType": "SHOW",
   384        "Original": "show create table user.user_extra",
   385        "Instructions": {
   386          "OperatorType": "Send",
   387          "Keyspace": {
   388            "Name": "user",
   389            "Sharded": true
   390          },
   391          "TargetDestination": "AnyShard()",
   392          "Query": "show create table user_extra",
   393          "SingleShardOnly": true
   394        }
   395      }
   396    },
   397    {
   398      "comment": "show create table with unsharded as default keyspace",
   399      "query": "show create table unknown",
   400      "plan": {
   401        "QueryType": "SHOW",
   402        "Original": "show create table unknown",
   403        "Instructions": {
   404          "OperatorType": "Send",
   405          "Keyspace": {
   406            "Name": "main",
   407            "Sharded": false
   408          },
   409          "TargetDestination": "AnyShard()",
   410          "Query": "show create table unknown",
   411          "SingleShardOnly": true
   412        }
   413      }
   414    },
   415    {
   416      "comment": "show create table with table not present with qualifier",
   417      "query": "show create table user.unknown",
   418      "plan": "table unknown not found"
   419    },
   420    {
   421      "comment": "show create table from system_schema",
   422      "query": "show create table information_schema.tables",
   423      "plan": {
   424        "QueryType": "SHOW",
   425        "Original": "show create table information_schema.tables",
   426        "Instructions": {
   427          "OperatorType": "Send",
   428          "Keyspace": {
   429            "Name": "main",
   430            "Sharded": false
   431          },
   432          "TargetDestination": "AnyShard()",
   433          "Query": "show create table information_schema.`tables`",
   434          "SingleShardOnly": true
   435        }
   436      }
   437    },
   438    {
   439      "comment": "show tables",
   440      "query": "show tables",
   441      "plan": {
   442        "QueryType": "SHOW",
   443        "Original": "show tables",
   444        "Instructions": {
   445          "OperatorType": "RenameFields",
   446          "Columns": [
   447            "Tables_in_main"
   448          ],
   449          "Indices": [
   450            0
   451          ],
   452          "Inputs": [
   453            {
   454              "OperatorType": "Send",
   455              "Keyspace": {
   456                "Name": "main",
   457                "Sharded": false
   458              },
   459              "TargetDestination": "AnyShard()",
   460              "Query": "show tables",
   461              "SingleShardOnly": true
   462            }
   463          ]
   464        }
   465      }
   466    },
   467    {
   468      "comment": "show tables from db",
   469      "query": "show tables from user",
   470      "plan": {
   471        "QueryType": "SHOW",
   472        "Original": "show tables from user",
   473        "Instructions": {
   474          "OperatorType": "RenameFields",
   475          "Columns": [
   476            "Tables_in_user"
   477          ],
   478          "Indices": [
   479            0
   480          ],
   481          "Inputs": [
   482            {
   483              "OperatorType": "Send",
   484              "Keyspace": {
   485                "Name": "user",
   486                "Sharded": true
   487              },
   488              "TargetDestination": "AnyShard()",
   489              "Query": "show tables",
   490              "SingleShardOnly": true
   491            }
   492          ]
   493        }
   494      }
   495    },
   496    {
   497      "comment": "show tables from system schema",
   498      "query": "show tables from performance_schema",
   499      "plan": {
   500        "QueryType": "SHOW",
   501        "Original": "show tables from performance_schema",
   502        "Instructions": {
   503          "OperatorType": "RenameFields",
   504          "Columns": [
   505            "Tables_in_performance_schema"
   506          ],
   507          "Indices": [
   508            0
   509          ],
   510          "Inputs": [
   511            {
   512              "OperatorType": "Send",
   513              "Keyspace": {
   514                "Name": "main",
   515                "Sharded": false
   516              },
   517              "TargetDestination": "AnyShard()",
   518              "Query": "show tables from performance_schema",
   519              "SingleShardOnly": true
   520            }
   521          ]
   522        }
   523      }
   524    },
   525    {
   526      "comment": "show migrations with db and like",
   527      "query": "show vitess_migrations from user like '%format'",
   528      "plan": {
   529        "QueryType": "SHOW",
   530        "Original": "show vitess_migrations from user like '%format'",
   531        "Instructions": {
   532          "OperatorType": "Send",
   533          "Keyspace": {
   534            "Name": "user",
   535            "Sharded": true
   536          },
   537          "TargetDestination": "AllShards()",
   538          "Query": "SELECT * FROM _vt.schema_migrations where migration_uuid LIKE '%format' OR migration_context LIKE '%format' OR migration_status LIKE '%format'"
   539        }
   540      }
   541    },
   542    {
   543      "comment": "show migrations with db and where",
   544      "query": "show vitess_migrations from user where id = 5",
   545      "plan": {
   546        "QueryType": "SHOW",
   547        "Original": "show vitess_migrations from user where id = 5",
   548        "Instructions": {
   549          "OperatorType": "Send",
   550          "Keyspace": {
   551            "Name": "user",
   552            "Sharded": true
   553          },
   554          "TargetDestination": "AllShards()",
   555          "Query": "SELECT * FROM _vt.schema_migrations where id = 5"
   556        }
   557      }
   558    },
   559    {
   560      "comment": "show vgtid",
   561      "query": "show global vgtid_executed",
   562      "plan": {
   563        "QueryType": "SHOW",
   564        "Original": "show global vgtid_executed",
   565        "Instructions": {
   566          "OperatorType": "Aggregate",
   567          "Variant": "Ordered",
   568          "Aggregates": "vgtid(1) AS global vgtid_executed",
   569          "ResultColumns": 2,
   570          "Inputs": [
   571            {
   572              "OperatorType": "Send",
   573              "Keyspace": {
   574                "Name": "main",
   575                "Sharded": false
   576              },
   577              "TargetDestination": "AllShards()",
   578              "Query": "select 'main' as db_name, @@global.gtid_executed as gtid_executed, :__vt_shard as shard",
   579              "ShardNameNeeded": true
   580            }
   581          ]
   582        }
   583      }
   584    },
   585    {
   586      "comment": "show gtid",
   587      "query": "show global gtid_executed from user",
   588      "plan": {
   589        "QueryType": "SHOW",
   590        "Original": "show global gtid_executed from user",
   591        "Instructions": {
   592          "OperatorType": "Send",
   593          "Keyspace": {
   594            "Name": "user",
   595            "Sharded": true
   596          },
   597          "TargetDestination": "AllShards()",
   598          "Query": "select 'user' as db_name, @@global.gtid_executed as gtid_executed, :__vt_shard as shard",
   599          "ShardNameNeeded": true
   600        }
   601      }
   602    },
   603    {
   604      "comment": "show warnings",
   605      "query": "show warnings",
   606      "plan": {
   607        "QueryType": "SHOW",
   608        "Original": "show warnings",
   609        "Instructions": {
   610          "OperatorType": "SHOW WARNINGS"
   611        }
   612      }
   613    },
   614    {
   615      "comment": "show global status",
   616      "query": "show global status",
   617      "plan": {
   618        "QueryType": "SHOW",
   619        "Original": "show global status",
   620        "Instructions": {
   621          "OperatorType": "Send",
   622          "Keyspace": {
   623            "Name": "main",
   624            "Sharded": false
   625          },
   626          "TargetDestination": "AnyShard()",
   627          "Query": "show global status",
   628          "SingleShardOnly": true
   629        }
   630      }
   631    },
   632    {
   633      "comment": "show plugins",
   634      "query": "show plugins",
   635      "plan": {
   636        "QueryType": "SHOW",
   637        "Original": "show plugins",
   638        "Instructions": {
   639          "OperatorType": "Rows",
   640          "Fields": {
   641            "Library": "VARCHAR",
   642            "License": "VARCHAR",
   643            "Name": "VARCHAR",
   644            "Status": "VARCHAR",
   645            "Type": "VARCHAR"
   646          },
   647          "RowCount": 1
   648        }
   649      }
   650    },
   651    {
   652      "comment": "show engines",
   653      "query": "show engines",
   654      "plan": {
   655        "QueryType": "SHOW",
   656        "Original": "show engines",
   657        "Instructions": {
   658          "OperatorType": "Rows",
   659          "Fields": {
   660            "Comment": "VARCHAR",
   661            "Engine": "VARCHAR",
   662            "Savepoints": "VARCHAR",
   663            "Support": "VARCHAR",
   664            "Transactions": "VARCHAR",
   665            "XA": "VARCHAR"
   666          },
   667          "RowCount": 1
   668        }
   669      }
   670    },
   671    {
   672      "comment": "show vitess_shards",
   673      "query": "show vitess_shards",
   674      "plan": {
   675        "QueryType": "SHOW",
   676        "Original": "show vitess_shards",
   677        "Instructions": {
   678          "OperatorType": "ShowExec",
   679          "Variant": " vitess_shards"
   680        }
   681      }
   682    },
   683    {
   684      "comment": "show vitess_tablets",
   685      "query": "show vitess_tablets",
   686      "plan": {
   687        "QueryType": "SHOW",
   688        "Original": "show vitess_tablets",
   689        "Instructions": {
   690          "OperatorType": "ShowExec",
   691          "Variant": " vitess_tablets"
   692        }
   693      }
   694    },
   695    {
   696      "comment": "show vitess_tablets with filter",
   697      "query": "show vitess_tablets like '-2%'",
   698      "plan": {
   699        "QueryType": "SHOW",
   700        "Original": "show vitess_tablets like '-2%'",
   701        "Instructions": {
   702          "OperatorType": "ShowExec",
   703          "Variant": " vitess_tablets",
   704          "Filter": " like '-2%'"
   705        }
   706      }
   707    },
   708    {
   709      "comment": "show vschema tables",
   710      "query": "show vschema tables",
   711      "plan": {
   712        "QueryType": "SHOW",
   713        "Original": "show vschema tables",
   714        "Instructions": {
   715          "OperatorType": "Rows",
   716          "Fields": {
   717            "Tables": "VARCHAR"
   718          },
   719          "RowCount": 11
   720        }
   721      }
   722    },
   723    {
   724      "comment": "show vschema vindexes",
   725      "query": "show vschema vindexes",
   726      "plan": {
   727        "QueryType": "SHOW",
   728        "Original": "show vschema vindexes",
   729        "Instructions": {
   730          "OperatorType": "Rows",
   731          "Fields": {
   732            "Keyspace": "VARCHAR",
   733            "Name": "VARCHAR",
   734            "Owner": "VARCHAR",
   735            "Params": "VARCHAR",
   736            "Type": "VARCHAR"
   737          }
   738        }
   739      }
   740    },
   741    {
   742      "comment": "show vschema vindexes on a table",
   743      "query": "show vschema vindexes on user.user",
   744      "plan": {
   745        "QueryType": "SHOW",
   746        "Original": "show vschema vindexes on user.user",
   747        "Instructions": {
   748          "OperatorType": "Rows",
   749          "Fields": {
   750            "Columns": "VARCHAR",
   751            "Name": "VARCHAR",
   752            "Owner": "VARCHAR",
   753            "Params": "VARCHAR",
   754            "Type": "VARCHAR"
   755          }
   756        }
   757      }
   758    },
   759    {
   760      "comment": "show vitess target",
   761      "query": "show vitess_target",
   762      "plan": {
   763        "QueryType": "SHOW",
   764        "Original": "show vitess_target",
   765        "Instructions": {
   766          "OperatorType": "Rows",
   767          "Fields": {
   768            "Target": "VARCHAR"
   769          },
   770          "RowCount": 1
   771        }
   772      }
   773    },
   774    {
   775      "comment": "show vitess_replication_status",
   776      "query": "show vitess_replication_status",
   777      "plan": {
   778        "QueryType": "SHOW",
   779        "Original": "show vitess_replication_status",
   780        "Instructions": {
   781          "OperatorType": "ShowExec",
   782          "Variant": " vitess_replication_status"
   783        }
   784      }
   785    },
   786    {
   787      "comment": "show vitess_replication_status with filter",
   788      "query": "show vitess_replication_status like 'x'",
   789      "plan": {
   790        "QueryType": "SHOW",
   791        "Original": "show vitess_replication_status like 'x'",
   792        "Instructions": {
   793          "OperatorType": "ShowExec",
   794          "Variant": " vitess_replication_status",
   795          "Filter": " like 'x'"
   796        }
   797      }
   798    },
   799    {
   800      "comment": "show vitess_metadata variables",
   801      "query": "show vitess_metadata variables",
   802      "plan": {
   803        "QueryType": "SHOW",
   804        "Original": "show vitess_metadata variables",
   805        "Instructions": {
   806          "OperatorType": "ShowExec",
   807          "Variant": " vitess_metadata variables"
   808        }
   809      }
   810    },
   811    {
   812      "comment": "show vitess_metadata variables with filter",
   813      "query": "show vitess_metadata variables like 'x'",
   814      "plan": {
   815        "QueryType": "SHOW",
   816        "Original": "show vitess_metadata variables like 'x'",
   817        "Instructions": {
   818          "OperatorType": "ShowExec",
   819          "Variant": " vitess_metadata variables",
   820          "Filter": " like 'x'"
   821        }
   822      }
   823    }
   824  ]