📄 outerjoin.out
字号:
Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=3 Number of rows visited=8 Scan type=heap start position: null stop position: null scan qualifiers:Non&ij> select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 left outer join tt3 on tt2.c2 = tt3.c3 where tt2.c2 = 3;C1 |C2 |C3 |C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------------------------------------------3 |4 |5 |2 |3 |4 |1 |2 |3 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 left outer join tt3 on tt2.c2 = tt3.c3 where tt2.c2 = 3Parse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0Execute Time: 0Begin Compilation Timestamp : nullEnd Compilation Timestamp : nullBegin Execution Timestamp : nullEnd Execution Timestamp : nullStatement Execution Plan Text: Nested Loop Left Outer Join ResultSet:Number of opens = 1Rows seen from the left = 1Rows seen from the right = 1Empty right rows returned = 0Rows filtered = 0Rows returned = 1 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0Left result set: Hash Join ResultSet: Number of opens = 1 Rows seen from the left = 3 Rows seen from the right = 1 Rows filtered = 0 Rows returned = 1 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 Left result set: Table Scan ResultSet for TT1 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 3 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=3 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:None Right result set: Hash Scan ResultSet for TT2 at read committed isolation level using instantaneous share row locking: Number of opens = 3 Hash table size = 1 Hash key is column number 1 Rows seen = 1 Rows filtered = 0 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=1 Number of rows visited=8 Scan type=heap start position: null stop position: null scan qualifiers:Column[0][0] Id: 1Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: false next qualifiers:Column[0][0] Id: 1Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseRight result set: Table Scan ResultSet for TT3 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 1 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=1 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:Column[0][0] Id: 2Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseij> -- make sure predicates are null tolerant select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where char(tt2.c2) is null;C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------1 |2 |3 |NULL |NULL |NULL ij> -- where java.lang.Integer::toString(tt2.c2) = '2';values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: -- make sure predicates are null tolerant select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where char(tt2.c2) is nullParse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0Execute Time: 0Begin Compilation Timestamp : nullEnd Compilation Timestamp : nullBegin Execution Timestamp : nullEnd Execution Timestamp : nullStatement Execution Plan Text: Project-Restrict ResultSet (4):Number of opens = 1Rows seen = 3Rows filtered = 2restriction = trueprojection = false constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0Source result set: Hash Left Outer Join ResultSet: Number of opens = 1 Rows seen from the left = 3 Rows seen from the right = 2 Empty right rows returned = 0 Rows filtered = 0 Rows returned = 3 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 Left result set: Table Scan ResultSet for TT1 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 3 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=3 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:None Right result set: Hash Scan ResultSet for TT2 at read committed isolation level using instantaneous share row locking: Number of opens = 3 Hash table size = 3 Hash key is column number 1 Rows seen = 2 Rows filtered = 0 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=3 Number of rows visited=8 Scan type=heap start position: null stop position: null scan qualifiers:None next qualifiers:Column[0][0] Id: 1Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseij> commit;ij> -- bug 2924, cross join under an outer joinCREATE TABLE inventory(itemno INT NOT NULL PRIMARY KEY, capacity INT);0 rows inserted/updated/deletedij> INSERT INTO inventory VALUES (1, 4);1 row inserted/updated/deletedij> INSERT INTO inventory VALUES (2, 2);1 row inserted/updated/deletedij> INSERT INTO inventory VALUES (3, 2);1 row inserted/updated/deletedij> CREATE TABLE timeslots (slotno INT NOT NULL PRIMARY KEY);0 rows inserted/updated/deletedij> INSERT INTO timeslots VALUES(1);1 row inserted/updated/deletedij> INSERT INTO timeslots VALUES(2);1 row inserted/updated/deletedij> create table reservations(slotno INT CONSTRAINT timeslots_fk REFERENCES timeslots, itemno INT CONSTRAINT inventory_fk REFERENCES inventory, name VARCHAR(100), resdate DATE);0 rows inserted/updated/deletedij> INSERT INTO reservations VALUES(1, 1, 'Joe', '2000-04-14');1 row inserted/updated/deletedij> INSERT INTO reservations VALUES(1, 1, 'Fred', '2000-04-13');1 row inserted/updated/deletedij> -- This query used to cause a null pointer exceptionselect name, resdate from reservations left outer join (inventory join timeslots on inventory.itemno = timeslots.slotno)on inventory.itemno = reservations.itemno and timeslots.slotno = reservations.slotnowhere resdate = '2000-04-14';NAME |RESDATE ---------------------------------------------------------------------------------------------------------------Joe |2000-04-14ij> rollback;ij> -- bug 2923, cross join under an outer joincreate table inventory(itemno INT NOT NULL PRIMARY KEY, capacity INT);0 rows inserted/updated/deletedij> INSERT into inventory values (1, 4);1 row inserted/updated/deletedij> INSERT into inventory values (2, 2);1 row inserted/updated/deletedij> INSERT into inventory values (3, 2);1 row inserted/updated/deletedij> CREATE TABLE timeslots (slotno INT NOT NULL PRIMARY KEY);0 rows inserted/updated/deletedij> INSERT INTO timeslots VALUES(1);1 row inserted/updated/deletedij> INSERT INTO timeslots VALUES(2);1 row inserted/updated/deletedij> create table reservations(slotno INT CONSTRAINT timeslots_fk REFERENCES timeslots,itemno INT CONSTRAINT inventory_fk REFERENCES inventory,name VARCHAR(100));0 rows inserted/updated/deletedij> INSERT INTO reservations VALUES(1, 1, 'Joe');1 row inserted/updated/deletedij> INSERT INTO reservations VALUES(2, 2, 'Fred');1 row inserted/updated/deletedij> -- This query used to get inco
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -