📄 readcursorlocks.subsql
字号:
next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 5: heap cursor scan, group fetch = 2 (scan with committed deleted rows)-- Test full cursor scan on a data set with some deleted rows (the "even" ones).-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','2');-- RESOLVE: missing row locks-- WORKAROUND: creating an index and dropping it -- to force the query 'select a, b, c from a' to be recompiledcreate index ix1 on a(a);drop index ix1;commit;get cursor scan_cursor as 'select a, b, c from a';call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 6: heap cursor scan, group fetch = 1 (scan with "<" qualifier)-- Test "less than" qualified cursor scan on a data set.-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');get cursor scan_cursor as 'select a, b, c from a where a < 3';call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 7: heap cursor scan, group fetch = 2 (scan with "<" qualifier)-- Test "less than" qualified cursor scan on a data set.-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','2');-- RESOLVE: missing row locks-- WORKAROUND: creating an index and dropping it -- to force the statement to be recompiledcreate index ix1 on a(a);drop index ix1;commit;get cursor scan_cursor as 'select a, b, c from a where a < 3';call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 8: heap cursor scan, group fetch = 1 (scan with equals qualifier)-- Test "equals" qualified cursor scan on a data set.-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');get cursor scan_cursor as 'select a, b, c from a where a = 5';call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 9: heap cursor scan, group fetch = 2 (scan with equals qualifier)-- Test "equals" qualified cursor scan on a data set.-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','2');get cursor scan_cursor as 'select a, b, c from a where a = 7';call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;---------------------------------------------------------------------------------- TEST 10: heap cursor scan, group fetch = 1 (equals qualifier, no rows return)-- Test "equals" qualified cursor scan on a data set, no rows returned.-- SERIALIZABLE - will get table level S lock.-- REPEATABLE READ - TABLE IS, will get row S locks as it visits each row -- (including deleted ones).-- READ COMMITTED - TABLE IS, will get instantaneous locks and release-- READ UNCOMMITTED - TABLE IS, no row locks.---- At this point the table should look like:-- 1, 10, 'one'-- 3, 30, 'three'-- 5, 50, 'five'-- 7, 70, 'seven'--------------------------------------------------------------------------------CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');-- RESOLVE: missing row locks-- WORKAROUND: creating an index and dropping it -- to force the statement to be recompiledcreate index ix1 on a(a);drop index ix1;commit;get cursor scan_cursor as 'select a, b, c from a where a = 7';CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','16');select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;next scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;close scan_cursor;select * from lock_table order by tabname, type desc, mode, cnt, lockname;commit;drop table a;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -