📄 tablelockbasic.out
字号:
ij> commit;ij> ---------------------------------------------------------------------------------- Test delete from a indexed heap, should get exclusive table lock.--------------------------------------------------------------------------------delete from indexed_heap where a = 1;1 row inserted/updated/deletedij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------APP |UserTran|TABLE |2 |X |INDEXED_HEAP|Tablelock |GRANT|ACTIVE ij> commit;ij> ---------------------------------------------------------------------------------- Test update to indexed heap, should get exclusive table lock.--------------------------------------------------------------------------------update indexed_heap set a = 1000 where a = 2;1 row inserted/updated/deletedij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------APP |UserTran|TABLE |4 |X |INDEXED_HEAP|Tablelock |GRANT|ACTIVE ij> commit;ij> ---------------------------------------------------------------------------------- Test drop of indexed heap, should get exclusive table lock.--------------------------------------------------------------------------------drop table indexed_heap;0 rows inserted/updated/deletedij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------APP |UserTran|TABLE |1 |X |*** TRANSIEN|Tablelock |GRANT|ACTIVE APP |UserTran|TABLE |4 |X |*** TRANSIEN|Tablelock |GRANT|ACTIVE ij> commit;ij> ---------------------------------------------------------------------------------- Test LOCK TABLE statement--------------------------------------------------------------------------------create table t1(c1 int);0 rows inserted/updated/deletedij> commit;ij> prepare p1 as 'lock table t1 in exclusive mode';ij> execute p1;0 rows inserted/updated/deletedij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------APP |UserTran|TABLE |1 |X |T1 |Tablelock |GRANT|ACTIVE ij> -- verify that statement gets recompiled correctlydrop table t1;0 rows inserted/updated/deletedij> create table t1(c1 int);0 rows inserted/updated/deletedij> execute p1;0 rows inserted/updated/deletedij> commit;ij> lock table t1 in share mode;0 rows inserted/updated/deletedij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------APP |UserTran|TABLE |1 |S |T1 |Tablelock |GRANT|ACTIVE ij> drop table t1;0 rows inserted/updated/deletedij> commit;ij> -- verify that lock table not allowed in sys schemalock table sys.systables in exclusive mode;ERROR 42X62: 'LOCK TABLE' is not allowed in the 'SYS' schema.ij> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE |CNT |MODE|TABNAME |LOCKNAME |STATE|STATUS ---------------------------------------------------------------------------ij> commit;ij> ---------------------------------------------------------------------------------- Test RTS output when table locking configured--------------------------------------------------------------------------------call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);0 rows inserted/updated/deletedij> maximumdisplaywidth 2000;ij> create table rts(c1 int);0 rows inserted/updated/deletedij> insert into rts values 1;1 row inserted/updated/deletedij> commit;ij> select * from rts with cs;C1 -----------1 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from rts with csParse 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: Table Scan ResultSet for RTS at read committed isolation level using instantaneous share row locking chosen by the optimizer (Actual locking used: table level locking.)Number of opens = 1Rows seen = 1Rows filtered = 0Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0scan information: Bit set of columns fetched=All Number of columns fetched=1 Number of pages visited=1 Number of rows qualified=1 Number of rows visited=1 Scan type=heap start position: null stop position: null qualifiers:Noneij> drop table rts;0 rows inserted/updated/deletedij> commit;ij> ---------------------------------------------------------------------------------- Test DDL TABLE LOCK MODE--------------------------------------------------------------------------------create table default_granularity(c1 int);0 rows inserted/updated/deletedij> create table row_granularity(c1 int);0 rows inserted/updated/deletedij> alter table row_granularity locksize row;0 rows inserted/updated/deletedij> create table table_granularity(c1 int);0 rows inserted/updated/deletedij> alter table table_granularity locksize table;0 rows inserted/updated/deletedij> select * from default_granularity with cs;C1 -----------ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from default_granularity with csParse 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: Table Scan ResultSet for DEFAULT_GRANULARITY at read committed isolation level using instantaneous share row locking chosen by the optimizer (Actual locking used: table level locking.)Number of opens = 1Rows seen = 0Rows filtered = 0Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0scan information: Bit set of columns fetched=All Number of columns fetched=1 Number of pages visited=1 Number of rows qualified=0 Number of rows visited=0 Scan type=heap start position: null stop position: null qualifiers:Noneij> select * from default_granularity with rr;C1 -----------ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from default_granularity with rrParse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -