primary-key-optimizations.td 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-arg-default single-replica-cluster=quickstart
  10. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  11. ALTER SYSTEM SET unsafe_enable_table_keys = true
  12. ALTER SYSTEM SET enable_primary_key_not_enforced = true
  13. #
  14. # Test that the knowledge that a given set of fields forms a primary key is used by the optimizer to remove grouping and distinct operations
  15. #
  16. # Remove references to internal table identifiers and "materialize.public" strings
  17. $ set-regex match=(\s\(u\d+\)|materialize\.public\.) replacement=
  18. $ set keyschema-2keys={
  19. "type": "record",
  20. "name": "Key",
  21. "fields": [
  22. {"name": "key1", "type": "string"},
  23. {"name": "key2", "type": "string"}
  24. ]
  25. }
  26. $ set schema={
  27. "type" : "record",
  28. "name" : "test",
  29. "fields" : [
  30. {"name":"nokey", "type":"string"}
  31. ]
  32. }
  33. $ kafka-create-topic topic=t1
  34. $ kafka-ingest format=avro topic=t1 key-format=avro key-schema=${keyschema-2keys} schema=${schema}
  35. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  36. URL '${testdrive.schema-registry-url}'
  37. );
  38. > CREATE CONNECTION kafka_conn
  39. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  40. > CREATE SOURCE t1
  41. IN CLUSTER ${arg.single-replica-cluster}
  42. FROM KAFKA CONNECTION kafka_conn (TOPIC
  43. 'testdrive-t1-${testdrive.seed}')
  44. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  45. ENVELOPE UPSERT;
  46. > CREATE DEFAULT INDEX ON t1
  47. # Optimization is possible - no distinct is mentioned in the plan
  48. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM t1;
  49. Explained Query (fast path):
  50. Project (#0, #1)
  51. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  52. Used Indexes:
  53. - t1_primary_idx (*** full scan ***)
  54. Target cluster: quickstart
  55. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM t1;
  56. Explained Query (fast path):
  57. Project (#0, #1)
  58. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  59. Used Indexes:
  60. - t1_primary_idx (*** full scan ***)
  61. Target cluster: quickstart
  62. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2, key1 FROM t1;
  63. Explained Query (fast path):
  64. Project (#1, #0)
  65. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  66. Used Indexes:
  67. - t1_primary_idx (*** full scan ***)
  68. Target cluster: quickstart
  69. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2, key1 FROM t1;
  70. Explained Query (fast path):
  71. Project (#1, #0)
  72. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  73. Used Indexes:
  74. - t1_primary_idx (*** full scan ***)
  75. Target cluster: quickstart
  76. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2, key1, key2 FROM t1;
  77. Explained Query (fast path):
  78. Project (#1, #0, #1)
  79. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  80. Used Indexes:
  81. - t1_primary_idx (*** full scan ***)
  82. Target cluster: quickstart
  83. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2, key1, key2 FROM t1;
  84. Explained Query (fast path):
  85. Project (#1, #0, #1)
  86. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  87. Used Indexes:
  88. - t1_primary_idx (*** full scan ***)
  89. Target cluster: quickstart
  90. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2, key1 FROM t1 GROUP BY key1, key2;
  91. Explained Query (fast path):
  92. Project (#1, #0)
  93. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  94. Used Indexes:
  95. - t1_primary_idx (*** full scan ***)
  96. Target cluster: quickstart
  97. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2, key1 FROM t1 GROUP BY key1, key2;
  98. Explained Query (fast path):
  99. Project (#1, #0)
  100. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  101. Used Indexes:
  102. - t1_primary_idx (*** full scan ***)
  103. Target cluster: quickstart
  104. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2, key1 FROM t1 GROUP BY key1, key2, key2 || 'a';
  105. Explained Query (fast path):
  106. Project (#1, #0)
  107. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  108. Used Indexes:
  109. - t1_primary_idx (*** full scan ***)
  110. Target cluster: quickstart
  111. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2, key1 FROM t1 GROUP BY key1, key2, key2 || 'a';
  112. Explained Query (fast path):
  113. Project (#1, #0)
  114. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  115. Used Indexes:
  116. - t1_primary_idx (*** full scan ***)
  117. Target cluster: quickstart
  118. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2, nokey FROM t1;
  119. Explained Query (fast path):
  120. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  121. Used Indexes:
  122. - t1_primary_idx (*** full scan ***)
  123. Target cluster: quickstart
  124. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2, nokey FROM t1;
  125. Explained Query (fast path):
  126. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  127. Used Indexes:
  128. - t1_primary_idx (*** full scan ***)
  129. Target cluster: quickstart
  130. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1, key2, nokey FROM t1 GROUP BY key1, key2, nokey;
  131. Explained Query (fast path):
  132. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  133. Used Indexes:
  134. - t1_primary_idx (*** full scan ***)
  135. Target cluster: quickstart
  136. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1, key2, nokey FROM t1 GROUP BY key1, key2, nokey;
  137. Explained Query (fast path):
  138. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  139. Used Indexes:
  140. - t1_primary_idx (*** full scan ***)
  141. Target cluster: quickstart
  142. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1, key2 FROM t1 GROUP BY key1, key2 HAVING key1 = 'a';
  143. Explained Query (fast path):
  144. Project (#0, #1)
  145. Filter (#0 = "a")
  146. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  147. Used Indexes:
  148. - t1_primary_idx (*** full scan ***)
  149. Target cluster: quickstart
  150. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1, key2 FROM t1 GROUP BY key1, key2 HAVING key1 = 'a';
  151. Explained Query (fast path):
  152. Project (#0, #1)
  153. Filter (#0 = "a")
  154. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  155. Used Indexes:
  156. - t1_primary_idx (*** full scan ***)
  157. Target cluster: quickstart
  158. # Optimization not possible - explicit distinct is present in planFor certain types of tests the 
  159. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1 FROM t1;
  160. Explained Query:
  161. Distinct project=[#0]
  162. Project (#0)
  163. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  164. Used Indexes:
  165. - t1_primary_idx (*** full scan ***)
  166. Target cluster: quickstart
  167. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1 FROM t1;
  168. Explained Query:
  169. Distinct project=[#0]
  170. Project (#0)
  171. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  172. Used Indexes:
  173. - t1_primary_idx (*** full scan ***)
  174. Target cluster: quickstart
  175. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2 FROM t1;
  176. Explained Query:
  177. Distinct project=[#0]
  178. Project (#1)
  179. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  180. Used Indexes:
  181. - t1_primary_idx (*** full scan ***)
  182. Target cluster: quickstart
  183. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2 FROM t1;
  184. Explained Query:
  185. Distinct project=[#0]
  186. Project (#1)
  187. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  188. Used Indexes:
  189. - t1_primary_idx (*** full scan ***)
  190. Target cluster: quickstart
  191. ?[version>=14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, upper(key2) FROM t1;
  192. Explained Query:
  193. Distinct project=[#0, upper(#1{key2})]
  194. Project (#0, #1)
  195. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  196. Used Indexes:
  197. - t1_primary_idx (*** full scan ***)
  198. Target cluster: quickstart
  199. ?[13500<=version<14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, upper(key2) FROM t1;
  200. Explained Query:
  201. Distinct project=[#0, upper(#1)]
  202. Project (#0, #1)
  203. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  204. Used Indexes:
  205. - t1_primary_idx (*** full scan ***)
  206. Target cluster: quickstart
  207. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, upper(key2) FROM t1;
  208. Explained Query:
  209. Distinct project=[#0, upper(#1)]
  210. Project (#0, #1)
  211. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  212. Used Indexes:
  213. - t1_primary_idx (*** full scan ***)
  214. Target cluster: quickstart
  215. ?[14400<=version] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 || 'a' FROM t1;
  216. Explained Query:
  217. Distinct project=[#0, (#1{key2} || "a")]
  218. Project (#0, #1)
  219. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  220. Used Indexes:
  221. - t1_primary_idx (*** full scan ***)
  222. Target cluster: quickstart
  223. ?[13500<=version<14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 || 'a' FROM t1;
  224. Explained Query:
  225. Distinct project=[#0, (#1 || "a")]
  226. Project (#0, #1)
  227. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  228. Used Indexes:
  229. - t1_primary_idx (*** full scan ***)
  230. Target cluster: quickstart
  231. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 || 'a' FROM t1;
  232. Explained Query:
  233. Distinct project=[#0, (#1 || "a")]
  234. Project (#0, #1)
  235. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  236. Used Indexes:
  237. - t1_primary_idx (*** full scan ***)
  238. Target cluster: quickstart
  239. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1 FROM t1 GROUP BY key1;
  240. Explained Query:
  241. Distinct project=[#0]
  242. Project (#0)
  243. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  244. Used Indexes:
  245. - t1_primary_idx (*** full scan ***)
  246. Target cluster: quickstart
  247. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1 FROM t1 GROUP BY key1;
  248. Explained Query:
  249. Distinct project=[#0]
  250. Project (#0)
  251. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  252. Used Indexes:
  253. - t1_primary_idx (*** full scan ***)
  254. Target cluster: quickstart
  255. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2 FROM t1 GROUP BY key2;
  256. Explained Query:
  257. Distinct project=[#0]
  258. Project (#1)
  259. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  260. Used Indexes:
  261. - t1_primary_idx (*** full scan ***)
  262. Target cluster: quickstart
  263. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2 FROM t1 GROUP BY key2;
  264. Explained Query:
  265. Distinct project=[#0]
  266. Project (#1)
  267. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  268. Used Indexes:
  269. - t1_primary_idx (*** full scan ***)
  270. Target cluster: quickstart
  271. # Make sure that primary key information is inherited from the source
  272. > CREATE VIEW v1 AS SELECT * FROM t1;
  273. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM v1;
  274. Explained Query (fast path):
  275. Project (#0, #1)
  276. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  277. Used Indexes:
  278. - t1_primary_idx (*** full scan ***)
  279. Target cluster: quickstart
  280. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM v1;
  281. Explained Query (fast path):
  282. Project (#0, #1)
  283. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  284. Used Indexes:
  285. - t1_primary_idx (*** full scan ***)
  286. Target cluster: quickstart
  287. > CREATE VIEW v2 AS SELECT * FROM t1;
  288. > CREATE DEFAULT INDEX ON v2;
  289. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM v2;
  290. Explained Query (fast path):
  291. Project (#0, #1)
  292. ReadIndex on=v2 v2_primary_idx=[*** full scan ***]
  293. Used Indexes:
  294. - v2_primary_idx (*** full scan ***)
  295. Target cluster: quickstart
  296. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM v2;
  297. Explained Query (fast path):
  298. Project (#0, #1)
  299. ReadIndex on=v2 v2_primary_idx=[*** full scan ***]
  300. Used Indexes:
  301. - v2_primary_idx (*** full scan ***)
  302. Target cluster: quickstart
  303. # Make sure that having a DISTINCT or GROUP BY confers PK semantics on upstream views
  304. > CREATE VIEW distinct_view AS SELECT DISTINCT nokey FROM t1;
  305. > CREATE DEFAULT INDEX ON distinct_view;
  306. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT nokey FROM distinct_view
  307. Explained Query (fast path):
  308. ReadIndex on=distinct_view distinct_view_primary_idx=[*** full scan ***]
  309. Used Indexes:
  310. - distinct_view_primary_idx (*** full scan ***)
  311. Target cluster: quickstart
  312. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT nokey FROM distinct_view
  313. Explained Query (fast path):
  314. ReadIndex on=distinct_view distinct_view_primary_idx=[*** full scan ***]
  315. Used Indexes:
  316. - distinct_view_primary_idx (*** full scan ***)
  317. Target cluster: quickstart
  318. > CREATE VIEW group_by_view AS SELECT nokey || 'a' AS f1 , nokey || 'b' AS f2 FROM t1 GROUP BY nokey || 'a', nokey || 'b';
  319. > CREATE DEFAULT INDEX ON group_by_view;
  320. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT f1, f2 FROM group_by_view;
  321. Explained Query (fast path):
  322. ReadIndex on=group_by_view group_by_view_primary_idx=[*** full scan ***]
  323. Used Indexes:
  324. - group_by_view_primary_idx (*** full scan ***)
  325. Target cluster: quickstart
  326. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT f1, f2 FROM group_by_view;
  327. Explained Query (fast path):
  328. ReadIndex on=group_by_view group_by_view_primary_idx=[*** full scan ***]
  329. Used Indexes:
  330. - group_by_view_primary_idx (*** full scan ***)
  331. Target cluster: quickstart
  332. # Redundant table is eliminated from an inner join using PK information
  333. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM t1 AS a1, t1 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  334. Explained Query (fast path):
  335. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  336. Used Indexes:
  337. - t1_primary_idx (*** full scan ***)
  338. Target cluster: quickstart
  339. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM t1 AS a1, t1 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  340. Explained Query (fast path):
  341. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  342. Used Indexes:
  343. - t1_primary_idx (*** full scan ***)
  344. Target cluster: quickstart
  345. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM v1 AS a1, v1 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  346. Explained Query (fast path):
  347. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  348. Used Indexes:
  349. - t1_primary_idx (*** full scan ***)
  350. Target cluster: quickstart
  351. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM v1 AS a1, v1 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  352. Explained Query (fast path):
  353. ReadIndex on=t1 t1_primary_idx=[*** full scan ***]
  354. Used Indexes:
  355. - t1_primary_idx (*** full scan ***)
  356. Target cluster: quickstart
  357. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM v2 AS a1, v2 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  358. Explained Query (fast path):
  359. ReadIndex on=v2 v2_primary_idx=[*** full scan ***]
  360. Used Indexes:
  361. - v2_primary_idx (*** full scan ***)
  362. Target cluster: quickstart
  363. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM v2 AS a1, v2 AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  364. Explained Query (fast path):
  365. ReadIndex on=v2 v2_primary_idx=[*** full scan ***]
  366. Used Indexes:
  367. - v2_primary_idx (*** full scan ***)
  368. Target cluster: quickstart
  369. # Declare a key constraint (PRIMARY KEY NOT ENFORCED); otherwise identical tests as above.
  370. $ set schema={
  371. "type" : "record",
  372. "name" : "test",
  373. "fields" : [
  374. {"name":"key1","type":"string"},
  375. {"name":"key2","type":"string"},
  376. {"name":"nokey", "type":"string"}
  377. ]
  378. }
  379. $ kafka-create-topic topic=t1-pkne
  380. $ kafka-ingest format=avro topic=t1-pkne schema=${schema}
  381. > CREATE SOURCE t1_pkne (PRIMARY KEY (key1, key2) NOT ENFORCED)
  382. IN CLUSTER ${arg.single-replica-cluster}
  383. FROM KAFKA CONNECTION kafka_conn (TOPIC
  384. 'testdrive-t1-pkne-${testdrive.seed}')
  385. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  386. ENVELOPE NONE;
  387. > CREATE DEFAULT INDEX ON t1_pkne
  388. # Optimization is possible - no distinct is mentioned in the plan
  389. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM t1_pkne;
  390. Explained Query (fast path):
  391. Project (#0, #1)
  392. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  393. Used Indexes:
  394. - t1_pkne_primary_idx (*** full scan ***)
  395. Target cluster: quickstart
  396. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM t1_pkne;
  397. Explained Query (fast path):
  398. Project (#0, #1)
  399. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  400. Used Indexes:
  401. - t1_pkne_primary_idx (*** full scan ***)
  402. Target cluster: quickstart
  403. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2, key1 FROM t1_pkne;
  404. Explained Query (fast path):
  405. Project (#1, #0)
  406. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  407. Used Indexes:
  408. - t1_pkne_primary_idx (*** full scan ***)
  409. Target cluster: quickstart
  410. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2, key1 FROM t1_pkne;
  411. Explained Query (fast path):
  412. Project (#1, #0)
  413. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  414. Used Indexes:
  415. - t1_pkne_primary_idx (*** full scan ***)
  416. Target cluster: quickstart
  417. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2, key1, key2 FROM t1_pkne;
  418. Explained Query (fast path):
  419. Project (#1, #0, #1)
  420. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  421. Used Indexes:
  422. - t1_pkne_primary_idx (*** full scan ***)
  423. Target cluster: quickstart
  424. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2, key1, key2 FROM t1_pkne;
  425. Explained Query (fast path):
  426. Project (#1, #0, #1)
  427. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  428. Used Indexes:
  429. - t1_pkne_primary_idx (*** full scan ***)
  430. Target cluster: quickstart
  431. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2, key1 FROM t1_pkne GROUP BY key1, key2;
  432. Explained Query (fast path):
  433. Project (#1, #0)
  434. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  435. Used Indexes:
  436. - t1_pkne_primary_idx (*** full scan ***)
  437. Target cluster: quickstart
  438. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2, key1 FROM t1_pkne GROUP BY key1, key2;
  439. Explained Query (fast path):
  440. Project (#1, #0)
  441. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  442. Used Indexes:
  443. - t1_pkne_primary_idx (*** full scan ***)
  444. Target cluster: quickstart
  445. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2, key1 FROM t1_pkne GROUP BY key1, key2, key2 || 'a';
  446. Explained Query (fast path):
  447. Project (#1, #0)
  448. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  449. Used Indexes:
  450. - t1_pkne_primary_idx (*** full scan ***)
  451. Target cluster: quickstart
  452. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2, key1 FROM t1_pkne GROUP BY key1, key2, key2 || 'a';
  453. Explained Query (fast path):
  454. Project (#1, #0)
  455. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  456. Used Indexes:
  457. - t1_pkne_primary_idx (*** full scan ***)
  458. Target cluster: quickstart
  459. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2, nokey FROM t1_pkne;
  460. Explained Query (fast path):
  461. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  462. Used Indexes:
  463. - t1_pkne_primary_idx (*** full scan ***)
  464. Target cluster: quickstart
  465. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2, nokey FROM t1_pkne;
  466. Explained Query (fast path):
  467. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  468. Used Indexes:
  469. - t1_pkne_primary_idx (*** full scan ***)
  470. Target cluster: quickstart
  471. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1, key2, nokey FROM t1_pkne GROUP BY key1, key2, nokey;
  472. Explained Query (fast path):
  473. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  474. Used Indexes:
  475. - t1_pkne_primary_idx (*** full scan ***)
  476. Target cluster: quickstart
  477. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1, key2, nokey FROM t1_pkne GROUP BY key1, key2, nokey;
  478. Explained Query (fast path):
  479. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  480. Used Indexes:
  481. - t1_pkne_primary_idx (*** full scan ***)
  482. Target cluster: quickstart
  483. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1, key2 FROM t1_pkne GROUP BY key1, key2 HAVING key1 = 'a';
  484. Explained Query (fast path):
  485. Project (#0, #1)
  486. Filter (#0 = "a")
  487. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  488. Used Indexes:
  489. - t1_pkne_primary_idx (*** full scan ***)
  490. Target cluster: quickstart
  491. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1, key2 FROM t1_pkne GROUP BY key1, key2 HAVING key1 = 'a';
  492. Explained Query (fast path):
  493. Project (#0, #1)
  494. Filter (#0 = "a")
  495. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  496. Used Indexes:
  497. - t1_pkne_primary_idx (*** full scan ***)
  498. Target cluster: quickstart
  499. # Optimization not possible - explicit distinct is present in plan
  500. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1 FROM t1_pkne;
  501. Explained Query:
  502. Distinct project=[#0] monotonic
  503. Project (#0)
  504. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  505. Used Indexes:
  506. - t1_pkne_primary_idx (*** full scan ***)
  507. Target cluster: quickstart
  508. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1 FROM t1_pkne;
  509. Explained Query:
  510. Distinct project=[#0] monotonic
  511. Project (#0)
  512. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  513. Used Indexes:
  514. - t1_pkne_primary_idx (*** full scan ***)
  515. Target cluster: quickstart
  516. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key2 FROM t1_pkne;
  517. Explained Query:
  518. Distinct project=[#0] monotonic
  519. Project (#1)
  520. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  521. Used Indexes:
  522. - t1_pkne_primary_idx (*** full scan ***)
  523. Target cluster: quickstart
  524. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key2 FROM t1_pkne;
  525. Explained Query:
  526. Distinct project=[#0] monotonic
  527. Project (#1)
  528. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  529. Used Indexes:
  530. - t1_pkne_primary_idx (*** full scan ***)
  531. Target cluster: quickstart
  532. ?[version>=14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, upper(key2) FROM t1_pkne;
  533. Explained Query:
  534. Distinct project=[#0, upper(#1{key2})] monotonic
  535. Project (#0, #1)
  536. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  537. Used Indexes:
  538. - t1_pkne_primary_idx (*** full scan ***)
  539. Target cluster: quickstart
  540. ?[13500<=version<14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, upper(key2) FROM t1_pkne;
  541. Explained Query:
  542. Distinct project=[#0, upper(#1)] monotonic
  543. Project (#0, #1)
  544. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  545. Used Indexes:
  546. - t1_pkne_primary_idx (*** full scan ***)
  547. Target cluster: quickstart
  548. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, upper(key2) FROM t1_pkne;
  549. Explained Query:
  550. Distinct project=[#0, upper(#1)] monotonic
  551. Project (#0, #1)
  552. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  553. Used Indexes:
  554. - t1_pkne_primary_idx (*** full scan ***)
  555. Target cluster: quickstart
  556. ?[version>=14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 || 'a' FROM t1_pkne;
  557. Explained Query:
  558. Distinct project=[#0, (#1{key2} || "a")] monotonic
  559. Project (#0, #1)
  560. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  561. Used Indexes:
  562. - t1_pkne_primary_idx (*** full scan ***)
  563. Target cluster: quickstart
  564. ?[13500<=version<14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 || 'a' FROM t1_pkne;
  565. Explained Query:
  566. Distinct project=[#0, (#1 || "a")] monotonic
  567. Project (#0, #1)
  568. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  569. Used Indexes:
  570. - t1_pkne_primary_idx (*** full scan ***)
  571. Target cluster: quickstart
  572. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 || 'a' FROM t1_pkne;
  573. Explained Query:
  574. Distinct project=[#0, (#1 || "a")] monotonic
  575. Project (#0, #1)
  576. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  577. Used Indexes:
  578. - t1_pkne_primary_idx (*** full scan ***)
  579. Target cluster: quickstart
  580. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key1 FROM t1_pkne GROUP BY key1;
  581. Explained Query:
  582. Distinct project=[#0] monotonic
  583. Project (#0)
  584. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  585. Used Indexes:
  586. - t1_pkne_primary_idx (*** full scan ***)
  587. Target cluster: quickstart
  588. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key1 FROM t1_pkne GROUP BY key1;
  589. Explained Query:
  590. Distinct project=[#0] monotonic
  591. Project (#0)
  592. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  593. Used Indexes:
  594. - t1_pkne_primary_idx (*** full scan ***)
  595. Target cluster: quickstart
  596. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT key2 FROM t1_pkne GROUP BY key2;
  597. Explained Query:
  598. Distinct project=[#0] monotonic
  599. Project (#1)
  600. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  601. Used Indexes:
  602. - t1_pkne_primary_idx (*** full scan ***)
  603. Target cluster: quickstart
  604. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT key2 FROM t1_pkne GROUP BY key2;
  605. Explained Query:
  606. Distinct project=[#0] monotonic
  607. Project (#1)
  608. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  609. Used Indexes:
  610. - t1_pkne_primary_idx (*** full scan ***)
  611. Target cluster: quickstart
  612. ?[version>=14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT COUNT(DISTINCT key1) FROM t1_pkne;
  613. Explained Query:
  614. With
  615. cte l0 =
  616. Reduce aggregates=[count(distinct #0{key1})] monotonic
  617. Project (#0)
  618. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  619. Return
  620. Union
  621. Get l0
  622. Map (0)
  623. Union
  624. Negate
  625. Project ()
  626. Get l0
  627. Constant
  628. - ()
  629. Used Indexes:
  630. - t1_pkne_primary_idx (*** full scan ***)
  631. Target cluster: quickstart
  632. ?[13500<=version<14400] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT COUNT(DISTINCT key1) FROM t1_pkne;
  633. Explained Query:
  634. With
  635. cte l0 =
  636. Reduce aggregates=[count(distinct #0)] monotonic
  637. Project (#0)
  638. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  639. Return
  640. Union
  641. Get l0
  642. Map (0)
  643. Union
  644. Negate
  645. Project ()
  646. Get l0
  647. Constant
  648. - ()
  649. Used Indexes:
  650. - t1_pkne_primary_idx (*** full scan ***)
  651. Target cluster: quickstart
  652. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT COUNT(DISTINCT key1) FROM t1_pkne;
  653. Explained Query:
  654. With
  655. cte l0 =
  656. Reduce aggregates=[count(distinct #0)] monotonic
  657. Project (#0)
  658. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  659. Return
  660. Union
  661. Get l0
  662. Map (0)
  663. Union
  664. Negate
  665. Project ()
  666. Get l0
  667. Constant
  668. - ()
  669. Used Indexes:
  670. - t1_pkne_primary_idx (*** full scan ***)
  671. Target cluster: quickstart
  672. # Make sure that primary key information is inherited from the source
  673. > CREATE VIEW v1_pkne AS SELECT * FROM t1_pkne;
  674. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM v1_pkne;
  675. Explained Query (fast path):
  676. Project (#0, #1)
  677. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  678. Used Indexes:
  679. - t1_pkne_primary_idx (*** full scan ***)
  680. Target cluster: quickstart
  681. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM v1_pkne;
  682. Explained Query (fast path):
  683. Project (#0, #1)
  684. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  685. Used Indexes:
  686. - t1_pkne_primary_idx (*** full scan ***)
  687. Target cluster: quickstart
  688. > CREATE VIEW v2_pkne AS SELECT * FROM t1_pkne;
  689. > CREATE DEFAULT INDEX ON v2_pkne;
  690. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT key1, key2 FROM v2_pkne;
  691. Explained Query (fast path):
  692. Project (#0, #1)
  693. ReadIndex on=v2_pkne v2_pkne_primary_idx=[*** full scan ***]
  694. Used Indexes:
  695. - v2_pkne_primary_idx (*** full scan ***)
  696. Target cluster: quickstart
  697. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT key1, key2 FROM v2_pkne;
  698. Explained Query (fast path):
  699. Project (#0, #1)
  700. ReadIndex on=v2_pkne v2_pkne_primary_idx=[*** full scan ***]
  701. Used Indexes:
  702. - v2_pkne_primary_idx (*** full scan ***)
  703. Target cluster: quickstart
  704. # Make sure that having a DISTINCT or GROUP BY confers PK semantics on upstream views
  705. > CREATE VIEW distinct_view_pkne AS SELECT DISTINCT nokey FROM t1_pkne;
  706. > CREATE DEFAULT INDEX ON distinct_view_pkne;
  707. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT nokey FROM distinct_view_pkne
  708. Explained Query (fast path):
  709. ReadIndex on=distinct_view_pkne distinct_view_pkne_primary_idx=[*** full scan ***]
  710. Used Indexes:
  711. - distinct_view_pkne_primary_idx (*** full scan ***)
  712. Target cluster: quickstart
  713. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT nokey FROM distinct_view_pkne
  714. Explained Query (fast path):
  715. ReadIndex on=distinct_view_pkne distinct_view_pkne_primary_idx=[*** full scan ***]
  716. Used Indexes:
  717. - distinct_view_pkne_primary_idx (*** full scan ***)
  718. Target cluster: quickstart
  719. > CREATE VIEW group_by_view_pkne AS SELECT nokey || 'a' AS f1 , nokey || 'b' AS f2 FROM t1_pkne GROUP BY nokey || 'a', nokey || 'b';
  720. > CREATE DEFAULT INDEX ON group_by_view_pkne;
  721. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT DISTINCT f1, f2 FROM group_by_view_pkne;
  722. Explained Query (fast path):
  723. ReadIndex on=group_by_view_pkne group_by_view_pkne_primary_idx=[*** full scan ***]
  724. Used Indexes:
  725. - group_by_view_pkne_primary_idx (*** full scan ***)
  726. Target cluster: quickstart
  727. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT DISTINCT f1, f2 FROM group_by_view_pkne;
  728. Explained Query (fast path):
  729. ReadIndex on=group_by_view_pkne group_by_view_pkne_primary_idx=[*** full scan ***]
  730. Used Indexes:
  731. - group_by_view_pkne_primary_idx (*** full scan ***)
  732. Target cluster: quickstart
  733. # Redundant table is eliminated from an inner join using PK information
  734. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM t1_pkne AS a1, t1_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  735. Explained Query (fast path):
  736. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  737. Used Indexes:
  738. - t1_pkne_primary_idx (*** full scan ***)
  739. Target cluster: quickstart
  740. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM t1_pkne AS a1, t1_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  741. Explained Query (fast path):
  742. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  743. Used Indexes:
  744. - t1_pkne_primary_idx (*** full scan ***)
  745. Target cluster: quickstart
  746. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM v1_pkne AS a1, v1_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  747. Explained Query (fast path):
  748. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  749. Used Indexes:
  750. - t1_pkne_primary_idx (*** full scan ***)
  751. Target cluster: quickstart
  752. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM v1_pkne AS a1, v1_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  753. Explained Query (fast path):
  754. ReadIndex on=t1_pkne t1_pkne_primary_idx=[*** full scan ***]
  755. Used Indexes:
  756. - t1_pkne_primary_idx (*** full scan ***)
  757. Target cluster: quickstart
  758. ?[version>=13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) AS VERBOSE TEXT FOR SELECT a1.* FROM v2_pkne AS a1, v2_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  759. Explained Query (fast path):
  760. ReadIndex on=v2_pkne v2_pkne_primary_idx=[*** full scan ***]
  761. Used Indexes:
  762. - v2_pkne_primary_idx (*** full scan ***)
  763. Target cluster: quickstart
  764. ?[version<13500] EXPLAIN OPTIMIZED PLAN WITH(no notices) FOR SELECT a1.* FROM v2_pkne AS a1, v2_pkne AS a2 WHERE a1.key1 = a2.key1 AND a1.key2 = a2.key2;
  765. Explained Query (fast path):
  766. ReadIndex on=v2_pkne v2_pkne_primary_idx=[*** full scan ***]
  767. Used Indexes:
  768. - v2_pkne_primary_idx (*** full scan ***)
  769. Target cluster: quickstart