更新时间:2025-03-13 GMT+08:00
执行计划
以如下SQL语句为例:
1 2 3 4 5 |
gaussdb=# DROP TABLE IF EXISTS t1; gaussdb=# DROP TABLE IF EXISTS t2; gaussdb=# CREATE TABLE t1 (c1 int, c2 int); gaussdb=# CREATE TABLE t2 (c1 int, c2 int); gaussdb=# SET explain_perf_mode = pretty; |
执行EXPLAIN的输出为:
gaussdb=# EXPLAIN SELECT * FROM t1,t2 WHERE t1.c1 = t2.c2; QUERY PLAN ------------------------------------------------------------------- Hash Join (cost=23.73..341.30 rows=16217 width=180) Hash Cond: (t1.c1 = t2.c2) -> Seq Scan on t1 (cost=0.00..122.17 rows=5317 width=76) -> Hash (cost=16.10..16.10 rows=610 width=104) -> Seq Scan on t2 (cost=0.00..16.10 rows=610 width=104) (5 rows) --删除表。 gaussdb=# DROP TABLE t1,t2;
执行计划层级解读(纵向):
父主题: 执行计划详解