문제

I have some performance issues with Informix queries. How can I profile these queries to narrow down the source of the problem?

도움이 되었습니까?

해결책 2

From here:-

The most comprehensive tool that Informix provides for collecting detailed SQL query plans and execution statistics is the SET EXPLAIN utility. This utility will generate a file called sqexplain.out, and records in detail every step of the query execution. In addition it provides the estimated costs of the query and estimates the query results. By examining the SET EXPLAIN output file, you can determine if steps can be taken to improve the performance of the query. The following example shows the set explain output for a pretty complex query:

SELECT --+AVOID_FULL(omchn)+AVOID_FULL(daphn)
                omchn.omc_hn_uanc,
                nvl(daphn.gtt_version,"0000000000000000000"),
                nvl(idachn.egt4_version,"0000000000000000000"),
                nvl(ihlrhn.hlr_timestamp,"00000000000000"),
                vsgw_hn.hn_igw_uanc,
                nvl(vsgw_hn.hn_igw_version, "00000000000000")
           FROM omchn, daphn, idachn, ihlrhn, vsgw_hn
          WHERE daphn.dap_hn_inst  = omchn.omc_hn_inst
            AND idachn.idac_hn_inst = omchn.omc_hn_inst
            AND ihlrhn.hlr_hn_inst = omchn.omc_hn_inst
            AND vsgw_hn.vsgw_hn_inst = omchn.omc_hn_inst

DIRECTIVES FOLLOWED:
AVOID_FULL ( omchn )
AVOID_FULL ( daphn )
DIRECTIVES NOT FOLLOWED:

Estimated Cost: 8
Estimated # of Rows Returned: 1

  1) root.idachn: SEQUENTIAL SCAN

  2) root.daphn: INDEX PATH

    (1) Index Keys: dap_hn_inst   (Serial, fragments: ALL)
        Lower Index Filter: root.daphn.dap_hn_inst = root.idachn.idac_hn_inst
NESTED LOOP JOIN

  3) root.vsgw_hn: SEQUENTIAL SCAN
NESTED LOOP JOIN

  4) root.omchn: INDEX PATH

                Filters: root.vsgw_hn.vsgw_hn_inst = root.omchn.omc_hn_inst
            (1) Index Keys: omc_hn_inst   (Serial, fragments: ALL)
      Lower Index Filter: root.idachn.idac_hn_inst = oot.omchn.omc_hn_inst
NESTED LOOP JOIN

     5) root.ihlrhn: INDEX PATH

            (1) Index Keys: hlr_hn_inst   (Serial, fragments: ALL)
      Lower Index Filter: root.ihlrhn.hlr_hn_inst = root.omchn.omc_hn_inst
NESTED LOOP JOIN

다른 팁

select  der.session_id,
der.blocking_session_id, 
der.wait_type, 
der.wait_time,
der.start_time, 
DATEDIFF(second,der.start_time,GETDATE())/60.0 AS executeTime_Minutes,
percent_complete,
der.status as requestStatus, 
des.login_name, 
cast(db_name(der.database_id) as varchar(30)) as databaseName,
 des.program_name,
 der.command as commandType,
der.percent_complete,
case des.transaction_isolation_level
 when 0 then 'Unspecified' when 1 then 'ReadUncomitted'
 when 2 then 'ReadCommitted' when 3 then 'Repeatable'
 when 4 then 'Serializable' when 5 then 'Snapshot'
 end as transaction_isolation_level,
char(13) + char(10) + Current Command + char(13) + char(10) + 
case when der.statement_end_offset = -1 then 

--see objectText-- else SUBSTRING(execText.textder.statement_start_offset/2, (der.statement_end_offset - der.statement_start_offset)/2) end + char(13) + char(10) + '------Full Object------------' AS currentExecutingCommand, execText.text as objectText from sys.dm_exec_sessions des --returns information about each user and internal system session on a SQL Server instance including session settings, security, and cumulative CPU, memory, and I/O usage join sys.dm_exec_requests as der --The sys.dm_exec_requests DMV shows us what is currently running on der.session_id = des.session_id
--on the SQL Server instance, its impact on memory, CPU, disk, and cache. outer apply sys.dm_exec_sql_text(der.sql_handle) as execText where --des.session_id <> @@spid and des.session_id > 40;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top