User bio
404 bio not found
Member since Feb 4, 2016
Posts:
Replies:
you can quickly access the SQL shell witj
USER>:SQL SQL Command Line Shell ---------------------------------------------------- The command prefix is currently set to: <<nothing>>. Enter <command>, 'q' to quit, '?' for help.
You might find some success looking at the tables/sqlprocs found in the %SQL* schemas
.png)
Certifications & Credly badges:





Global Masters badges:







Followers:
Following:
Stephen has not followed anybody yet.
Ben,
Can you provide some clarity around why some of your SQL statements which are SELECT statements do not use
while one of them does use %NOLOCK.
I always thought a by default a SELECT statement does not attempt to lock any of the records of any type of lock.
If I study the ObjectScript code generated to satisfy a SELECT statement like
select id from ens.messageHeader
it's not clear that any of this does any form of a lock(whether exclusive, shared etc)
%0Afirst ; asl MOD# 2 set i%Vsb23="" %0AmBk1 s i%Vsb23=$o(^Ens.MessageHeaderI("Extent",i%Vsb23),1,i%Vch24) i i%Vsb23="" { g %0AmBdun } s i%Vhi25=i%Vsb23-1*64000 s i%Vvecvar17=$vop("+",$vop("positions",i%Vch24),i%Vhi25-1) ; asl MOD# 3 set i%Vlo26="" %0AmCk1 s i%Vlo26=$bitfind(i%Vch24,1,i%Vlo26+1) i 'i%Vlo26 g %0AmCdun s i%IDO1=i%Vhi25+i%Vlo26-1 s i%IDO1=$ve(i%Vvecvar17,i%Vlo26) s:$g(SQLCODE)'<0 SQLCODE=0 s %ROWCOUNT=$i(i%rowcnt),%ROWID=i%IDO1,i%CursorState=10 //-- FETCH Output set:$l($g(i%querystats)) i%time=$g(i%time)+$zh-$lg(i%querystats),i%commands=$g(i%commands)+$zu(61,8,$zu(61))-$lg(i%querystats,2),i%querystats="" quit %QRS0f //-- FETCH tag i '$g(i%CursorState) { s SQLCODE=-102 q } i i%CursorState=100 { s SQLCODE=100 q } s SQLCODE=0 i i%rowlimit,i%rowcnt'<i%rowlimit { s SQLCODE=100,%ROWCOUNT=i%rowcnt,i%CursorState=100 q } Do $system.Process.AppFrameInfo(i%StackInfo) set i%querystats=$lb($zh,$zu(61,8,$zu(61))) g %0Afirst:i%CursorState=1 g %0AmCk1 %0AmCdun g %0AmBk1 %0AmBdun %0AmAdun s %ROWCOUNT=i%rowcnt,SQLCODE=100,i%CursorState=100 set:$l($g(i%querystats)) i%time=$g(i%time)+$zh-$lg(i%querystats),i%commands=$g(i%commands)+$zu(61,8,$zu(61))-$lg(i%querystats,2),i%querystats="" //-- no [more] data quitWhile the above is for a simple query and is completely index satisfiable, i.e. it doesnt have to read from the mastermap I dont think the question of lock/nolock changes for a SELECT statement.
Question:
Why would the usage of %NOLOCK ever come into play?