cancel
Showing results for 
Search instead for 
Did you mean: 

Strange query during a stored-procedure

1,715

Hi,

I made a stored-procedure that charck if a signature is good and re-do the signature (with different values).

I look with the profiler what appen and the server have execute 11 000+ time a query that isn't in my procedure during the execution of this last one.

Here the query :

select cast(null as char(128)) as "TABLE_CAT",
    "SYSUSER"."user_name" as "TABLE_SCHEM",
    "SYSTABLE"."table_name" as "TABLE_NAME",
    "column_name" as "COLUMN_NAME",
    cast((select "count"() from "SYS"."SYSCOLUMN" as "other" where "table_id" = "SYSTABLE"."table_id" and "column_id" <= "SYSCOLUMN"."column_id" and "pkey" = 'Y') as smallint) as "KEY_SEQ",
    "SYSCONSTRAINT"."constraint_name" as "PK_NAME"
from "SYS"."SYSCOLUMN" join "SYS"."SYSTABLE" on "SYSCOLUMN"."table_id" = "SYSTABLE"."table_id" join "SYS"."SYSUSER" on "SYSTABLE"."creator" = "SYSUSER"."user_id" join "SYS"."SYSCONSTRAINT" on("SYSTABLE"."object_id" = "SYSCONSTRAINT"."table_object_id")
where "user_name" = 'DBA'
and "table_name" = 'SIG'
and "pkey" = 'Y' and "constraint_type" = 'P'
order by 1 asc,2 asc,3 asc,5 asc

I passed the query, to see what is the result, it return this : TABLE_CAT;TABLE_SCHEM;TABLE_NAME;COLUMN_NAME;KEY_SEQ;PK_NAME

Null;'DBA';'SIG';'SigId';1;'ASA209'

This is the primary key of the table where I store the signature.

So did someone knows why the server run it 11 000+ times ?

thanks in advence.

Accepted Solutions (0)

Answers (2)

Answers (2)

jack_schueler
Product and Topic Expert
Product and Topic Expert

This looks like the query that is generated for the ODBC SQLPrimaryKeys() function. Do you have any ODBC applications running against the database?

0 Kudos

I find that my procedure had a "SELECT ... FROM" instead of "SELECT ... INTO ...FROM" in a loop, but I was running it from interactive sql so it run the procedure normaly, it could be the reason of these weird query I saw in the profiler ?

Breck_Carter
Participant

Please answer the questions in the first comment on your original question.

Breck_Carter
Participant

That query MAY have come from dbisql. You can see it and MANY MORE "strange queries" by starting dbsrv17 -zr ALL and then running this query in dbisql: SELECT * FROM dummy.

Here's what the request level logging output looks like (I'm sure scjview.exe does something similar):

Scroll down half-way to see your query "select cast(null as char(128))..."

0723 133954.249,<,1,CONNECT
+1,C,1,UID=dba;DBN='ddd17'
+8,>,1,CONNECT,1
+1,<,1,PREPARE,select "property"('ProductVersion'),case when 'A' <> 'a' then 1 else 0 end,"isnull"("property"('IsIQ'),'NO'),"isnull"("connection_property"('odbc_distinguish_char_and_varchar'),'Off'),"isnull"("connection_property"('odbc_describe_binary_as_varbinary'),'Off'),"connection_property"('charset'),"db_property"('charset'),"connection_property"('quoted_identifier'),case when "connection_property"('auto_commit') is null then 0 else 1 end
=,>,1,PREPARE,65536
=,<,1,EXEC,65536
=,P,1,[S]DUMMY<seq>{1}
=,>,1,EXEC
+1,<,1,DROP_STMT,65536
=,>,1,DROP_STMT
=,<,1,PREPARE,select "count"() from "SYS"."SYSOPTION" as "o","SYS"."SYSUSER" as "u" where "o"."user_id" = "u"."user_id" and "o"."option" = 'timestamp_with_time_zone_format' and "u"."user_name" = 'PUBLIC'
=,>,1,PREPARE,65537
=,<,1,EXEC,65537
+2,P,1,GrByS{1}[ su<user_name>{1} JNL{1} ISYSOPTION<isysoption(io)>{1} ]
=,>,1,EXEC
=,<,1,DROP_STMT,65537
=,>,1,DROP_STMT
=,<,1,PREPARE,  set temporary option "time_format" = 'hh:nn:ss';   set temporary option "timestamp_format" = 'yyyy-mm-dd hh:nn:ss.ssssss';   set temporary option "date_format" = 'yyyy-mm-dd';   set temporary option "date_order" = 'ymd';   set temporary option "isolation_level" = '0';   set temporary option "timestamp_with_time_zone_format" = 'yyyy-mm-dd hh:nn:ss.ssssss +hh:nn';   set temporary option "auto_commit" = 'ON'
=,>,1,PREPARE,65538
=,<,1,EXEC,65538
=,[,1,batch,1,set temporary option time_format = 'hh:nn:ss'
=,],1,batch,1
=,[,1,batch,1,set temporary option timestamp_format = 'yyyy-mm-dd hh:nn:ss.ssssss'
=,],1,batch,1
=,[,1,batch,1,set temporary option date_format = 'yyyy-mm-dd'
=,],1,batch,1
=,[,1,batch,1,set temporary option date_order = 'ymd'
=,],1,batch,1
=,[,1,batch,1,set temporary option isolation_level = '0'
=,],1,batch,1
=,[,1,batch,1,set temporary option timestamp_with_time_zone_format = 'yyyy-mm-dd hh:nn:ss.ssssss +hh:nn'
=,],1,batch,1
=,[,1,batch,1,set temporary option auto_commit = 'ON'
=,],1,batch,1
=,>,1,EXEC
+1,<,1,DROP_STMT,65538
=,>,1,DROP_STMT
=,<,1,PREPARE,set temporary option "ISOLATION_LEVEL" = 
+1,>,1,PREPARE,65539
=,<,1,DESC_OUT,65539
=,>,1,DESC_OUT
=,<,1,DESC_IN,65539
=,>,1,DESC_IN
=,<,1,EXEC,65539
=,>,1,EXEC
=,<,1,OPEN,65539
=,W,1,111,Statement cannot be executed
=,>,1,OPEN,0
=,<,1,DROP_STMT,65539
=,>,1,DROP_STMT
=,<,1,PREPARE,set temporary option "auto_commit" = 'OFF'
=,>,1,PREPARE,65540
=,<,1,EXEC,65540
=,>,1,EXEC
+28,<,1,DROP_STMT,65540
=,>,1,DROP_STMT
=,<,1,PREPARE,set temporary option "Connection_authentication" = 'Company=Sybase;Application=DBTools;Signature=000fa55157edb8e14d818eb4fe3db41447146f1571g2a1b5949cab32c7760419117ca3ce88770fecfd7'
=,>,1,PREPARE,65541
=,<,1,DESC_OUT,65541
=,>,1,DESC_OUT
=,<,1,DESC_IN,65541
=,>,1,DESC_IN
+1,<,1,EXEC,65541
=,>,1,EXEC
=,<,1,OPEN,65541
=,W,1,111,Statement cannot be executed
=,>,1,OPEN,0
=,<,1,DROP_STMT,65541
=,>,1,DROP_STMT
=,<,1,PREPARE,  set temporary option "sql_flagger_error_level" = 'W';   set temporary option "sql_flagger_warning_level" = 'W';   if("connection_property"('Suppress_TDS_debugging') is not null) then set temporary option "Suppress_TDS_debugging" = 'on' end if;   if("connection_property"('Return_date_time_as_string') is not null) then set temporary option "Return_date_time_as_String" = 'on' end if;   set "textsize" 2147483647
=,>,1,PREPARE,65542
=,<,1,DESC_OUT,65542
=,>,1,DESC_OUT
=,<,1,DESC_IN,65542
=,>,1,DESC_IN
=,<,1,EXEC,65542
=,[,1,batch,1,set temporary option sql_flagger_error_level = 'W'
=,],1,batch,1
=,[,1,batch,1,set temporary option sql_flagger_warning_level = 'W'
=,],1,batch,1
=,[,1,batch,1,set temporary option Suppress_TDS_debugging = 'on'
=,],1,batch,1
=,[,1,batch,1,set temporary option Return_date_time_as_String = 'on'
=,],1,batch,1
=,[,1,batch,1,set textsize 2147483647
=,],1,batch,1
=,>,1,EXEC
=,<,1,OPEN,65542
=,W,1,111,Statement cannot be executed
=,>,1,OPEN,0
+3,<,1,DROP_STMT,65542
=,>,1,DROP_STMT
=,<,1,PREPARE,select "db_name"()
=,>,1,PREPARE,65543
=,<,1,EXEC,65543
=,P,1,[S]DUMMY<seq>{1}
=,>,1,EXEC
=,<,1,DROP_STMT,65543
=,>,1,DROP_STMT
=,<,1,PREPARE,select "db_property"('ReadOnly')
=,>,1,PREPARE,65544
=,<,1,DESC_OUT,65544
=,>,1,DESC_OUT
=,<,1,DESC_IN,65544
=,>,1,DESC_IN
=,<,1,EXEC,65544
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,65544
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,65545
+3,<,1,DESCRIPTOR,65545
=,>,1
=,<,1,FETCH,65545,33,Rel,1
=,>,1
=,<,1,PREFETCH,65545
=,>,1
=,<,1,CLOSE_BY_NAME
=,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,65545
=,<,1,DROP_STMT,65544
=,>,1,DROP_STMT
=,<,1,PREPARE,select @@version
+1,>,1,PREPARE,65546
=,<,1,DESC_OUT,65546
=,>,1,DESC_OUT
=,<,1,DESC_IN,65546
=,>,1,DESC_IN
=,<,1,EXEC,65546
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,65546
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,65547
=,<,1,DESCRIPTOR,65547
=,>,1
=,<,1,FETCH,65547,33,Rel,1
=,>,1
=,<,1,PREFETCH,65547
=,>,1
+1,<,1,PREPARE,  if("connection_property"('return_date_time_as_string') is not null) then set temporary option "return_date_time_as_string" = 'off' end if;   if("connection_property"('Time_format') is not null) then set temporary option "Time_format" = end if;   if("connection_property"('Time_zone_adjustment') is not null) then set temporary option "Time_zone_adjustment" = '-240' end if;   if("connection_property"('Date_format') is not null) then set temporary option "Date_format" = end if;   if("connection_property"('Timestamp_format') is not null) then set temporary option "Timestamp_format" = end if;   if("connection_property"('Date_order') is not null) then set temporary option "Date_order" = end if;   if("connection_property"('Timestamp_with_time_zone_format') is not null) then set temporary option "Timestamp_with_time_zone_format" = end if;   if("connection_property"('Progress_messages') is not null) then set temporary option "Progress_messages" = 'formatted' end if
=,>,1,PREPARE,131084
=,<,1,DESC_OUT,131084
=,>,1,DESC_OUT
=,<,1,DESC_IN,131084
=,>,1,DESC_IN
=,<,1,EXEC,131084
=,[,1,batch,1,set temporary option return_date_time_as_string = 'off'
=,],1,batch,1
=,[,1,batch,1,set temporary option Time_format = 
=,],1,batch,1
=,[,1,batch,1,set temporary option Time_zone_adjustment = '-240'
=,],1,batch,1
=,[,1,batch,1,set temporary option Date_format = 
=,],1,batch,1
=,[,1,batch,1,set temporary option Timestamp_format = 
=,],1,batch,1
=,[,1,batch,1,set temporary option Date_order = 
=,],1,batch,1
=,[,1,batch,1,set temporary option Timestamp_with_time_zone_format = 
=,],1,batch,1
=,[,1,batch,1,set temporary option Progress_messages = 'formatted'
=,],1,batch,1
=,>,1,EXEC
=,<,1,OPEN,131084
=,W,1,111,Statement cannot be executed
=,>,1,OPEN,0
+1,<,1,DROP_STMT,131084
=,>,1,DROP_STMT
=,<,1,PREPARE,select "connection_property"('userid')
=,>,1,PREPARE,131085
=,<,1,EXEC,131085
=,P,1,[S]DUMMY<seq>{1}
=,>,1,EXEC
=,<,1,DROP_STMT,131085
=,>,1,DROP_STMT
=,<,1,PREPARE,select @@version
=,>,1,PREPARE,131086
=,<,1,DESC_OUT,131086
=,>,1,DESC_OUT
=,<,1,DESC_IN,131086
=,>,1,DESC_IN
=,<,1,EXEC,131086
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,131086
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,131087
=,<,1,DESCRIPTOR,131087
=,>,1
=,<,1,FETCH,131087,33,Rel,1
=,>,1
=,<,1,PREFETCH,131087
=,>,1
+1,<,1,PREPARE,select "property"('ServerName')
=,>,1,PREPARE,196624
=,<,1,DESC_OUT,196624
=,>,1,DESC_OUT
=,<,1,DESC_IN,196624
=,>,1,DESC_IN
=,<,1,EXEC,196624
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,196624
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,196625
+1,<,1,DESCRIPTOR,196625
=,>,1
=,<,1,FETCH,196625,33,Rel,1
=,>,1
=,<,1,PREFETCH,196625
=,>,1
=,<,1,CLOSE_BY_NAME
=,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,196625
=,<,1,DROP_STMT,196624
=,>,1,DROP_STMT
=,<,1,PREPARE,select null as "TABLE_CAT",null as "TABLE_SCHEM",null as "TABLE_NAME",'TABLE' as "TABLE_TYPE",null as "REMARKS" union all select null,null,null,'VIEW',null union all select null,null,null,'SYSTEM TABLE',null union all select null,null,null,'SYSTEM VIEW',null union all select null,null,null,'GLOBAL TEMPORARY',null union all select null,null,null,'TEXT',null union all select null,null,null,'PARTITION',null
=,>,1,PREPARE,196626
=,<,1,DESC_OUT,196626
+1,>,1,DESC_OUT
=,<,1,DESC_IN,196626
=,>,1,DESC_IN
=,<,1,EXEC,196626
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,196626
=,P,1,DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq>
=,>,1,OPEN,196627
=,<,1,DESCRIPTOR,196627
+1,>,1
=,<,1,FETCH,196627,33,Rel,1
=,>,1
=,<,1,PREFETCH,196627
=,>,1
=,<,1,CLOSE_BY_NAME
=,P,1,UA{7} [DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1}]
=,>,1,CLOSE_BY_NAME,196627
=,<,1,DROP_STMT,196626
=,>,1,DROP_STMT
=,<,1,PREPARE,select "db_name"()
=,>,1,PREPARE,196628
=,<,1,EXEC,196628
=,P,1,[S]DUMMY<seq>{1}
=,>,1,EXEC
+1,<,1,CACHED_DROP_STMT,196628
=,>,1
=,<,1,PREPARE,select "setting" from "sys"."SYSUSEROPTIONS" where "option" = 'post_login_procedure' and "user_name" = 'dba'
=,>,1,PREPARE,262165
=,<,1,DESC_OUT,262165
+1,>,1,DESC_OUT
=,<,1,DESC_IN,262165
=,>,1,DESC_IN
=,<,1,EXEC,262165
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,262165
+1,P,1,u<user_name> JNL u<user_name> JNL opt<isysoption> : s<isysoption>
=,>,1,OPEN,196630
=,<,1,DESCRIPTOR,196630
=,>,1
=,<,1,FETCH,196630,0,Rel,1
=,>,1
=,<,1,GETDATA,196630
=,>,1
=,<,1,CLOSE_BY_NAME
=,P,1,u<user_name>{1} JNL{1} u<user_name>{1} JNL{1} opt<isysoption>{1} : s<isysoption>{0}
=,>,1,CLOSE_BY_NAME,196630
=,<,1,DROP_STMT,262165
=,>,1,DROP_STMT
=,<,1,PREPARE,call "dbo"."sa_post_login_procedure"()
=,>,1,PREPARE,262167
=,<,1,DESC_OUT,262167
+1,>,1,DESC_OUT
=,<,1,DESC_IN,262167
=,>,1,DESC_IN
=,<,1,EXEC,262167
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,262167
=,[,1,sa_post_login_procedure,10,set password_about_to_expire = 0
=,],1,sa_post_login_procedure,10
=,[,1,sa_post_login_procedure,11,set creation_date = (select cast(password_creation_time as date)     from SYS.SYSUSER     where user_name = current user)
=,P,1,su<user_name>{1}
=,],1,sa_post_login_procedure,11
=,[,1,sa_post_login_procedure,14,set life_time = (select case login_option_value when 'unlimited' then-1 else login_option_value end     from SYS.SYSUSER as u       key join SYS.SYSLOGINPOLICY as lp       key join SYS.SYSLOGINPOLICYOPTION as lpo     where user_name = current user     and login_option_name = 'password_life_time')
+1,P,1,su<user_name>{1} JNL{1} ISYSLOGINPOLICYOPTION<isysloginpolicyoption>{1}
=,],1,sa_post_login_procedure,14
=,[,1,sa_post_login_procedure,51,set message_text = null
=,],1,sa_post_login_procedure,51
=,[,1,sa_post_login_procedure,52,set message_action = 0
=,],1,sa_post_login_procedure,52
=,[,1,sa_post_login_procedure,54,select message_text,message_action
+1,P,1,[S]DUMMY<seq>
=,],1,sa_post_login_procedure,54
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,196632
+1,<,1,DESCRIPTOR,196632
=,>,1
=,<,1,FETCH,196632,33,Rel,1
=,>,1
=,<,1,PREFETCH,196632
=,>,1
=,<,1,CLOSE_BY_NAME
=,P,1,[S][R][1]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,196632
=,<,1,DROP_STMT,262167
=,>,1,DROP_STMT
=,<,1,PREPARE,select "connection_extended_property"('CharSet','Java')
+1,>,1,PREPARE,262169
=,<,1,DESC_OUT,262169
=,>,1,DESC_OUT
=,<,1,DESC_IN,262169
=,>,1,DESC_IN
=,<,1,EXEC,262169
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,262169
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,196634
+1,<,1,DESCRIPTOR,196634
=,>,1
=,<,1,FETCH,196634,33,Rel,1
=,>,1
=,<,1,PREFETCH,196634
=,>,1
+19,<,1,CLOSE_BY_NAME
=,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,196634
=,<,1,DROP_STMT,262169
=,>,1,DROP_STMT
=,<,1,PREPARE,select "count"(distinct("creator" || '.' || "table_name")) from "sa_locks"("connection_property"('number')) where "table_name" <> 'EXCLUDEOBJECT'
=,>,1,PREPARE,262171
=,<,1,DESC_OUT,262171
=,>,1,DESC_OUT
=,<,1,DESC_IN,262171
=,>,1,DESC_IN
=,<,1,EXEC,262171
=,W,1,111,Statement cannot be executed
+1,>,1,EXEC
=,<,1,OPEN,262171
=,P,1,GrByS[ Sort[ sa_locks<call> ] ]
=,>,1,OPEN,196636
=,<,1,DESCRIPTOR,196636
=,>,1
=,<,1,FETCH,196636,33,Rel,1
=,>,1
=,<,1,PREFETCH,196636
=,>,1
+1,<,1,CLOSE_BY_NAME
=,P,1,GrByS{1}[ Sort{0}[ sa_locks<call>{0} ] ]
+1,>,1,CLOSE_BY_NAME,196636
=,<,1,DROP_STMT,262171
=,>,1,DROP_STMT
=,<,1,PREPARE,select "count"(distinct("creator" || '.' || "table_name")) from "sa_locks"("connection_property"('number')) where "table_name" <> 'EXCLUDEOBJECT'
=,>,1,PREPARE,262173
=,<,1,DESC_OUT,262173
=,>,1,DESC_OUT
=,<,1,DESC_IN,262173
=,>,1,DESC_IN
=,<,1,EXEC,262173
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,262173
=,P,1,GrByS[ Sort[ sa_locks<call> ] ]
=,>,1,OPEN,196638
=,<,1,DESCRIPTOR,196638
=,>,1
=,<,1,FETCH,196638,33,Rel,1
=,>,1
=,<,1,PREFETCH,196638
=,>,1
0723 134001.670,<,1,CLOSE_BY_NAME
=,P,1,GrByS{1}[ Sort{0}[ sa_locks<call>{0} ] ]
=,>,1,CLOSE_BY_NAME,196638
=,<,1,CACHED_DROP_STMT,262173
=,>,1
=,<,1,PREPARE,select null as "TABLE_CAT",null as "TABLE_SCHEM",null as "TABLE_NAME",'TABLE' as "TABLE_TYPE",null as "REMARKS" union all select null,null,null,'VIEW',null union all select null,null,null,'SYSTEM TABLE',null union all select null,null,null,'SYSTEM VIEW',null union all select null,null,null,'GLOBAL TEMPORARY',null union all select null,null,null,'TEXT',null union all select null,null,null,'PARTITION',null
=,>,1,PREPARE,327711
=,<,1,DESC_OUT,327711
+1,>,1,DESC_OUT
=,<,1,DESC_IN,327711
=,>,1,DESC_IN
=,<,1,EXEC,327711
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,327711
=,P,1,DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq> UA DUMMY<seq>
=,>,1,OPEN,196640
=,<,1,DESCRIPTOR,196640
=,>,1
=,<,1,FETCH,196640,33,Rel,1
=,>,1
=,<,1,PREFETCH,196640
=,>,1
+1,<,1,CLOSE_BY_NAME
=,P,1,UA{7} [DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1} UA DUMMY<seq>{1}]
=,>,1,CLOSE_BY_NAME,196640
=,<,1,CACHED_DROP_STMT,327711
=,>,1
=,<,1,PREPARE,select case 'A' when 'a' then 0 else 1 end
=,>,1,PREPARE,393249
=,<,1,DESC_OUT,393249
=,>,1,DESC_OUT
=,<,1,DESC_IN,393249
=,>,1,DESC_IN
=,<,1,EXEC,393249
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,393249
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,196642
=,<,1,DESCRIPTOR,196642
=,>,1
=,<,1,FETCH,196642,33,Rel,1
=,>,1
=,<,1,PREFETCH,196642
=,>,1
=,<,1,CLOSE_BY_NAME
+1,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,196642
=,<,1,DROP_STMT,393249
=,>,1,DROP_STMT
=,<,1,PREPARE,select "COUNT"() from "dbo"."EXCLUDEOBJECT"
=,>,1,PREPARE,393251
=,<,1,EXEC,393251
+1,P,1,[S]GrByS{1}[ EXCLUDEOBJECT<seq>{503} ]
=,>,1,EXEC
+1,<,1,DROP_STMT,393251
=,>,1,DROP_STMT
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","SYSUSER"."user_name" as "TABLE_SCHEM","SYSTABLE"."table_name" as "TABLE_NAME",case "table_type" when 'VIEW' then case when("user_name" = 'SYS') or("user_name" = 'rs_systabgroup') or("user_name" = 'dbo' and "table_name" = any(select "name" from "dbo"."EXCLUDEOBJECT" where "type" not in( 'P','T' ) )) then 'SYSTEM VIEW' else 'VIEW' end when 'BASE' then case when("user_name" = 'SYS') or("user_name" = 'rs_systabgroup') or("user_name" = 'dbo' and "table_name" = any(select "name" from "dbo"."EXCLUDEOBJECT" where "type" not in( 'P','T' ) )) then 'SYSTEM TABLE' else 'TABLE' end when 'GBL TEMP' then 'GLOBAL TEMPORARY' when 'MAT VIEW' then 'VIEW' when 'TEXT' then 'TEXT' when 'PARTITION' then 'PARTITION' else 'LOCAL TEMPORARY' end as "TABLE_TYPE",cast("byte_substr"("SYSTABLE"."remarks",1,254) as varchar(254)) as "REMARKS"   from "SYS"."SYSTABLE" join "SYS"."SYSUSER" on "SYSTABLE"."creator" = "SYSUSER"."user_id"   where "table_name" like 'dumm%' escape '~'   and "TABLE_TYPE" in( 'TABLE','GLOBAL TEMPORARY','VIEW','VIEW' )    order by 4 asc,1 asc,2 asc,3 asc
=,>,1,PREPARE,393252
=,<,1,DESC_OUT,393252
+4,>,1,DESC_OUT
=,<,1,DESC_IN,393252
=,>,1,DESC_IN
=,<,1,EXEC,393252
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,393252
+1,P,1,Work[ Sort[ tab<table_name> JNLO(m) r<seq> JNL su<isysuser> ] ] : EXCLUDEOBJECT<excludeobject> : EXCLUDEOBJECT<excludeobject>
+1,>,1,OPEN,196645
=,<,1,DESCRIPTOR,196645
=,>,1
=,<,1,FETCH,196645,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,196645
=,>,1
=,<,1,CLOSE,196645
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ tab<table_name>{1} JNLO(m){1} r<seq>{0} JNL{0} su<isysuser>{0} ] ] : EXCLUDEOBJECT<excludeobject> : EXCLUDEOBJECT<excludeobject>
=,>,1,CLOSE
+1,<,1,DROP_STMT,393252
=,>,1,DROP_STMT
=,<,1,VALIDATE_STMT,196628
=,>,1
=,<,1,EXEC,196628
=,P,1,[S][R][1]DUMMY<seq>{1}
=,>,1,EXEC
=,<,1,CACHED_DROP_STMT,196628
=,>,1
=,<,1,PREPARE,select cast(null as char(128)) as "PROCEDURE_CAT","user_name" as "PROCEDURE_SCHEM","proc_name" as "PROCEDURE_NAME",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and "parm_mode_in" = 'Y') as integer) as "NUM_INPUT_PARAMS",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and "parm_type" <> 1 and "parm_mode_out" = 'Y') as integer) as "NUM_OUTPUT_PARAMS",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and("parm_type" = 1 or("parm_mode_in" = 'N' and "parm_mode_out" = 'N'))) as integer) as "NUM_RESULT_SETS",cast("byte_substr"("SYSPROCEDURE"."remarks",1,254) as varchar(254)) as "REMARKS",cast("coalesce"(case(select "max"("parm_type") from "SYS"."SYSPROCPARM" where "proc_id" = "SYS"."SYSPROCEDURE"."proc_id") when 4 then 2 else 1 end,1) as smallint) as "PROCEDURE_TYPE"   from "SYS"."SYSPROCEDURE" join "SYS"."SYSUSER" on "SYSPROCEDURE"."creator" = "SYSUSER"."user_id"   where "proc_name" like 'dumm%' escape '~'   order by 1 asc,2 asc,3 asc
=,>,1,PREPARE,393254
=,<,1,DESC_OUT,393254
+2,>,1,DESC_OUT
=,<,1,DESC_IN,393254
=,>,1,DESC_IN
=,<,1,EXEC,393254
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,393254
+1,P,1,Work[ Sort[ b<procedure_name> JNLO(m) r<seq> JNL su<isysuser> ] ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ]
=,>,1,OPEN,196647
=,<,1,DESCRIPTOR,196647
+1,>,1
=,<,1,FETCH,196647,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,196647
=,>,1
=,<,1,CLOSE,196647
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ b<procedure_name>{0} JNLO(m){0} r<seq> JNL{0} su<isysuser> ] ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ]
=,>,1,CLOSE
=,<,1,DROP_STMT,393254
=,>,1,DROP_STMT
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","user_name" as "TABLE_SCHEM",cast(null as char(128)) as "TABLE_NAME",cast(null as char(128)) as "TABLE_TYPE",cast(null as char(254)) as "REMARKS"   from "SYS"."SYSUSER"   order by "user_name" asc
=,>,1,PREPARE,393256
=,<,1,DESC_OUT,393256
=,>,1,DESC_OUT
=,<,1,DESC_IN,393256
=,>,1,DESC_IN
=,<,1,EXEC,393256
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,393256
+1,P,1,Work[ Sort[ su<seq> ] ]
=,>,1,OPEN,196649
=,<,1,DESCRIPTOR,196649
=,>,1
=,<,1,FETCH,196649,33,Rel,1
=,>,1
=,<,1,PREFETCH,196649
=,W,1,100,Row not found
=,>,1
+635,<,1,USE_PREFETCH,196649
+1,>,1
=,<,1,PREPARE,select "COUNT"() from "dbo"."EXCLUDEOBJECT"
=,>,1,PREPARE,458794
=,<,1,EXEC,458794
+1,P,1,[S]GrByS{1}[ EXCLUDEOBJECT<seq>{503} ]
=,>,1,EXEC
=,<,1,CACHED_DROP_STMT,458794
=,>,1
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","SYSUSER"."user_name" as "TABLE_SCHEM","SYSTABLE"."table_name" as "TABLE_NAME",case "table_type" when 'VIEW' then case when("user_name" = 'SYS') or("user_name" = 'rs_systabgroup') or("user_name" = 'dbo' and "table_name" = any(select "name" from "dbo"."EXCLUDEOBJECT" where "type" not in( 'P','T' ) )) then 'SYSTEM VIEW' else 'VIEW' end when 'BASE' then case when("user_name" = 'SYS') or("user_name" = 'rs_systabgroup') or("user_name" = 'dbo' and "table_name" = any(select "name" from "dbo"."EXCLUDEOBJECT" where "type" not in( 'P','T' ) )) then 'SYSTEM TABLE' else 'TABLE' end when 'GBL TEMP' then 'GLOBAL TEMPORARY' when 'MAT VIEW' then 'VIEW' when 'TEXT' then 'TEXT' when 'PARTITION' then 'PARTITION' else 'LOCAL TEMPORARY' end as "TABLE_TYPE",cast("byte_substr"("SYSTABLE"."remarks",1,254) as varchar(254)) as "REMARKS"   from "SYS"."SYSTABLE" join "SYS"."SYSUSER" on "SYSTABLE"."creator" = "SYSUSER"."user_id"   where "table_name" like 'dummy%' escape '~'   and "TABLE_TYPE" in( 'TABLE','GLOBAL TEMPORARY','VIEW','VIEW' )    order by 4 asc,1 asc,2 asc,3 asc
=,>,1,PREPARE,524331
=,<,1,DESC_OUT,524331
+1,>,1,DESC_OUT
=,<,1,DESC_IN,524331
=,>,1,DESC_IN
=,<,1,EXEC,524331
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,524331
+1,P,1,Work[ Sort[ tab<table_name> JNLO(m) r<seq> JNL su<isysuser> ] ] : EXCLUDEOBJECT<excludeobject> : EXCLUDEOBJECT<excludeobject>
=,>,1,OPEN,262188
=,<,1,DESCRIPTOR,262188
=,>,1
=,<,1,FETCH,262188,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,262188
=,>,1
=,<,1,CLOSE,262188
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ tab<table_name>{1} JNLO(m){1} r<seq>{0} JNL{0} su<isysuser>{0} ] ] : EXCLUDEOBJECT<excludeobject> : EXCLUDEOBJECT<excludeobject>
+1,>,1,CLOSE
=,<,1,DROP_STMT,524331
=,>,1,DROP_STMT
=,<,1,VALIDATE_STMT,196628
=,>,1
=,<,1,EXEC,196628
=,P,1,[S][R][2]DUMMY<seq>{1}
=,>,1,EXEC
=,<,1,CACHED_DROP_STMT,196628
=,>,1
=,<,1,PREPARE,select cast(null as char(128)) as "PROCEDURE_CAT","user_name" as "PROCEDURE_SCHEM","proc_name" as "PROCEDURE_NAME",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and "parm_mode_in" = 'Y') as integer) as "NUM_INPUT_PARAMS",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and "parm_type" <> 1 and "parm_mode_out" = 'Y') as integer) as "NUM_OUTPUT_PARAMS",cast((select "count"() from "SYS"."SYSPROCPARM" where "proc_id" = "SYSPROCEDURE"."proc_id" and("parm_type" = 1 or("parm_mode_in" = 'N' and "parm_mode_out" = 'N'))) as integer) as "NUM_RESULT_SETS",cast("byte_substr"("SYSPROCEDURE"."remarks",1,254) as varchar(254)) as "REMARKS",cast("coalesce"(case(select "max"("parm_type") from "SYS"."SYSPROCPARM" where "proc_id" = "SYS"."SYSPROCEDURE"."proc_id") when 4 then 2 else 1 end,1) as smallint) as "PROCEDURE_TYPE"   from "SYS"."SYSPROCEDURE" join "SYS"."SYSUSER" on "SYSPROCEDURE"."creator" = "SYSUSER"."user_id"   where "proc_name" like 'dummy%' escape '~'   order by 1 asc,2 asc,3 asc
=,>,1,PREPARE,524333
=,<,1,DESC_OUT,524333
=,>,1,DESC_OUT
=,<,1,DESC_IN,524333
=,>,1,DESC_IN
+1,<,1,EXEC,524333
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,524333
+1,P,1,Work[ Sort[ b<procedure_name> JNLO(m) r<seq> JNL su<isysuser> ] ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ]
=,>,1,OPEN,262190
=,<,1,DESCRIPTOR,262190
=,>,1
=,<,1,FETCH,262190,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,262190
=,>,1
=,<,1,CLOSE,262190
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ b<procedure_name>{0} JNLO(m){0} r<seq> JNL{0} su<isysuser> ] ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ] : GrByS[ pp<isysprocedure> ]
=,>,1,CLOSE
+4,<,1,DROP_STMT,524333
=,>,1,DROP_STMT
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","user_name" as "TABLE_SCHEM",cast(null as char(128)) as "TABLE_NAME",cast(null as char(128)) as "TABLE_TYPE",cast(null as char(254)) as "REMARKS"   from "SYS"."SYSUSER"   order by "user_name" asc
=,>,1,PREPARE,524335
=,<,1,DESC_OUT,524335
=,>,1,DESC_OUT
=,<,1,DESC_IN,524335
=,>,1,DESC_IN
=,<,1,EXEC,524335
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,524335
=,P,1,Work[ Sort[ su<seq> ] ]
+1,>,1,OPEN,262192
=,<,1,DESCRIPTOR,262192
=,>,1
=,<,1,FETCH,262192,33,Rel,1
=,>,1
=,<,1,PREFETCH,262192
=,W,1,100,Row not found
=,>,1
+2982,<,1,USE_PREFETCH,262192
=,>,1
=,<,1,PREPARE,select * from "dummy"
=,>,1,PREPARE,589873
=,<,1,DESC_OUT,589873
+1,>,1,DESC_OUT
=,<,1,DESC_IN,589873
=,>,1,DESC_IN
+2,<,1,OPEN,589873
=,P,1,[S]DUMMY<seq>
=,>,1,OPEN,327730
+5,<,1,DESCRIPTOR,327730
=,>,1
=,<,1,FETCH,327730,33,Rel,1
=,>,1
=,<,1,PREFETCH,327730
=,>,1
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","SYSUSER"."user_name" as "TABLE_SCHEM","SYSTABLE"."table_name" as "TABLE_NAME","column_name" as "COLUMN_NAME",cast((select "count"() from "SYS"."SYSCOLUMN" as "other" where "table_id" = "SYSTABLE"."table_id" and "column_id" <= "SYSCOLUMN"."column_id" and "pkey" = 'Y') as smallint) as "KEY_SEQ","SYSCONSTRAINT"."constraint_name" as "PK_NAME"   from "SYS"."SYSCOLUMN" join "SYS"."SYSTABLE" on "SYSCOLUMN"."table_id" = "SYSTABLE"."table_id" join "SYS"."SYSUSER" on "SYSTABLE"."creator" = "SYSUSER"."user_id" join "SYS"."SYSCONSTRAINT" on("SYSTABLE"."object_id" = "SYSCONSTRAINT"."table_object_id")   where "user_name" = 'SYS'   and "table_name" = 'DUMMY'   and "pkey" = 'Y' and "constraint_type" = 'P'   order by 1 asc,2 asc,3 asc,5 asc
=,>,1,PREPARE,655411
=,<,1,DESC_OUT,655411
+3,>,1,DESC_OUT
=,<,1,DESC_IN,655411
=,>,1,DESC_IN
=,<,1,EXEC,655411
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,655411
+2,P,1,Work[ Sort[ tab<table_name> JNL su<user_name> JNL ISYSCONSTRAINT<isysobject001> JNL col<isystab> JNLO(m) c<isysidxcol> ] ] : GrByS[ col<isystabcol(io)> JNLO(m) c<isysidxcol> ]
=,>,1,OPEN,393268
=,<,1,DESCRIPTOR,393268
=,>,1
=,<,1,FETCH,393268,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,393268
=,>,1
=,<,1,CLOSE,393268
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ tab<table_name>{1} JNL{1} su<user_name>{1} JNL{0} ISYSCONSTRAINT<isysobject001>{0} JNL{0} col<isystab> JNLO(m){0} c<isysidxcol> ] ] : GrByS[ col<isystabcol(io)> JNLO(m) c<isysidxcol> ]
=,>,1,CLOSE
=,<,1,DROP_STMT,655411
=,>,1,DROP_STMT
=,<,1,PREPARE,select cast(null as char(128)) as "TABLE_CAT","SYSUSER"."user_name" as "TABLE_SCHEM","SYSTABLE"."table_name" as "TABLE_NAME","column_name" as "COLUMN_NAME",cast((select "count"() from "SYS"."SYSCOLUMN" as "other" where "table_id" = "SYSTABLE"."table_id" and "column_id" <= "SYSCOLUMN"."column_id" and "pkey" = 'Y') as smallint) as "KEY_SEQ","SYSCONSTRAINT"."constraint_name" as "PK_NAME"   from "SYS"."SYSCOLUMN" join "SYS"."SYSTABLE" on "SYSCOLUMN"."table_id" = "SYSTABLE"."table_id" join "SYS"."SYSUSER" on "SYSTABLE"."creator" = "SYSUSER"."user_id" join "SYS"."SYSCONSTRAINT" on("SYSTABLE"."object_id" = "SYSCONSTRAINT"."table_object_id")   where "user_name" = 'SYS'   and "table_name" = 'DUMMY'   and "pkey" = 'Y' and "constraint_type" = 'P'   order by 1 asc,2 asc,3 asc,5 asc
+1,>,1,PREPARE,655413
=,<,1,DESC_OUT,655413
=,>,1,DESC_OUT
=,<,1,DESC_IN,655413
=,>,1,DESC_IN
=,<,1,EXEC,655413
=,W,1,111,Statement cannot be executed
=,>,1,EXEC
=,<,1,OPEN,655413
+1,P,1,Work[ Sort[ tab<table_name> JNL su<user_name> JNL ISYSCONSTRAINT<isysobject001> JNL col<isystab> JNLO(m) c<isysidxcol> ] ] : GrByS[ col<isystabcol(io)> JNLO(m) c<isysidxcol> ]
=,>,1,OPEN,393270
+1,<,1,DESCRIPTOR,393270
=,>,1
=,<,1,FETCH,393270,33,Rel,1
=,W,1,100,Row not found
=,>,1
=,<,1,PREFETCH,393270
=,>,1
=,<,1,CLOSE,393270
=,I,1,0,0,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{0}[ Sort{0}[ tab<table_name>{1} JNL{1} su<user_name>{1} JNL{0} ISYSCONSTRAINT<isysobject001>{0} JNL{0} col<isystab> JNLO(m){0} c<isysidxcol> ] ] : GrByS[ col<isystabcol(io)> JNLO(m) c<isysidxcol> ]
=,>,1,CLOSE
+1,<,1,CACHED_DROP_STMT,655413
=,>,1
=,<,1,RESUME,327730
=,W,1,105,Procedure has completed
=,>,1
=,<,1,CLOSE,327730
=,I,1,0,1,0,NOSCROLL+READONLY+HOLD
=,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE
+69,<,1,DROP_STMT,589873
=,>,1,DROP_STMT
=,<,1,VALIDATE_STMT,262173
=,>,1
=,<,1,OPEN,262173
=,P,1,GrByS[ Sort[ sa_locks<call> ] ]
=,P,1,GrByS[ Sort[ sa_locks<call> ] ]
=,>,1,OPEN,327735
=,<,1,DESCRIPTOR,327735
=,>,1
+1,<,1,FETCH,327735,33,Rel,1
=,>,1
=,<,1,PREFETCH,327735
=,>,1
+1949,<,1,CLOSE_BY_NAME
+4,P,1,[R][0]GrByS{1}[ Sort{0}[ sa_locks<call>{1} ] ]
=,>,1,CLOSE_BY_NAME,327735
=,<,1,CACHED_DROP_STMT,262173
=,>,1
=,<,1,COMMIT
=,>.,1
=,<,1,CLOSE_BY_NAME
=,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,65547
=,<,1,DROP_STMT,65546
=,>,1,DROP_STMT
=,<,1,CLOSE,196649
=,I,1,0,129,0,NOSCROLL+READONLY+HOLD
=,P,1,Work{129}[ Sort{129}[ su<seq>{129} ] ]
=,>,1,CLOSE
=,<,1,DROP_STMT,393256
=,>,1,DROP_STMT
=,<,1,ROLLBACK
=,>.,1
=,<,1,CLOSE,262192
=,I,1,0,129,0,NOSCROLL*+READONLY+HOLD
=,P,1,Work{129}[ Sort{129}[ su<seq>{129} ] ]
=,>,1,CLOSE
+1,<,1,DROP_STMT,524335
=,>,1,DROP_STMT
=,<,1,CLOSE_BY_NAME
+3,P,1,[S]DUMMY<seq>{1}
=,>,1,CLOSE_BY_NAME,131087
=,<,1,DROP_STMT,131086
=,>,1,DROP_STMT
=,<,1,DISCONNECT
=,>,1

jack_schueler
Product and Topic Expert
Product and Topic Expert

Breck is correct. It could have come from dbisql since dbisql uses the JDBC driver which is built on ODBC and the JDBC driver makes use of SQLPrimaryKeys (getPrimaryKeys()) and other schema functions such as SQLTables (getTables(), getCatalogs(), getSchemas(), getTableTypes()), and many more.

VolkerBarth
Contributor
0 Kudos

But that would not yet explain several thousand calls of that ODBC catalog query, right?

Breck_Carter
Participant

It might, if a stored procedure called xp_cmdshell inside a loop to repeatedly run dbisql, instead of EXECUTE IMMEDIATE inside a loop... the difference in overhead might be significant 🙂