Hello ,
I'm not a DBA , but support a application . we had some query performance issues and while debugging , some of our queries were getting executed as follows.
declare p1 int
set p1=1073741825
declare p2 int
set p2=180150003
declare p7 int
set p7=1
exec sp_cursorprepexec p1 output,p2 output,N'P0 varchar(8000),P1 smallint',N'select count(RN_DEVICE.DeviceID) from RN_DEVICE WITH (NOLOCK) left join RN_DEVICE_DATA on RN_DEVICE.MostRecentConfigID=RN_DEVICE_DATA.DeviceDataID where (contains(RN_DEVICE_DATA.DataBlock, P0)) and RN_DEVICE.ManagementStatus <> P1 ',4104,8193,p7 output,'"vrf"',2
select p1, p2, p7
the query that we emit out of application doesn't indicate anything about cursor operation. it just a parameterized plain count query.
select count(RN_DEVICE.DeviceID) from RN_DEVICE WITH (NOLOCK) left join RN_DEVICE_DATA on RN_DEVICE.MostRecentConfigID=RN_DEVICE_DATA.DeviceDataID where (contains(RN_DEVICE_DATA.DataBlock, P0)) and RN_DEVICE.ManagementStatus <> P1
customer pointed out the use of cursors via sp_cursorprepexec and how it is prone to performance issues. I tried many things to get rid of sp_cursorprepexec . when i use the selectmethod=direct in jdbc URL it steps appending our queries with sp_cursorprepexec . But still it uses that method on some of these parameterized queries .
while on other threads i saw that when we choose selectmethod=direct , it must do away with sp_cursorprepexec .
please advice.
I'm not a DBA , but support a application . we had some query performance issues and while debugging , some of our queries were getting executed as follows.
declare p1 int
set p1=1073741825
declare p2 int
set p2=180150003
declare p7 int
set p7=1
exec sp_cursorprepexec p1 output,p2 output,N'P0 varchar(8000),P1 smallint',N'select count(RN_DEVICE.DeviceID) from RN_DEVICE WITH (NOLOCK) left join RN_DEVICE_DATA on RN_DEVICE.MostRecentConfigID=RN_DEVICE_DATA.DeviceDataID where (contains(RN_DEVICE_DATA.DataBlock, P0)) and RN_DEVICE.ManagementStatus <> P1 ',4104,8193,p7 output,'"vrf"',2
select p1, p2, p7
the query that we emit out of application doesn't indicate anything about cursor operation. it just a parameterized plain count query.
select count(RN_DEVICE.DeviceID) from RN_DEVICE WITH (NOLOCK) left join RN_DEVICE_DATA on RN_DEVICE.MostRecentConfigID=RN_DEVICE_DATA.DeviceDataID where (contains(RN_DEVICE_DATA.DataBlock, P0)) and RN_DEVICE.ManagementStatus <> P1
customer pointed out the use of cursors via sp_cursorprepexec and how it is prone to performance issues. I tried many things to get rid of sp_cursorprepexec . when i use the selectmethod=direct in jdbc URL it steps appending our queries with sp_cursorprepexec . But still it uses that method on some of these parameterized queries .
while on other threads i saw that when we choose selectmethod=direct , it must do away with sp_cursorprepexec .
please advice.