- 论坛徽章:
- 0
|
AIX UNIX平台: db2 7.2.0
Windows平台:db2 7.2.5 (7.2 + servicepack7)
测试sql语句:
select Ope.Operation,Info.OprNo,digits(Info.OprYear)||'-'||digits(Info.OprMonth)||'-'||digits(Info.OprDay) as OprDate,Info.AppDepart,'' as DepartName,User.UserName,Move.Amount,(case Move.DealFlag when '0' then '未处理' when '1' then '已提交/已同意' when '2' then '已驳回' when '3' then '已递交裁定' when '4' then '申请人终止' else '' end) as DealFlag,(case Move.VetoFlag when '0' then '正常业务' when '1' then '被驳回的业务' else '' end) as VetoFlag,(case Info.EndFlag when '0' then '流转中' when '1' then '流转结束' when '2' then '' when '3' then '财务处理中' when '4' then '财务处理中' when '9' then '业务终止' else '' end) as EndFlag,Info.OprBrief,Info.OprYear,Info.OprMonth,Info.OprDay,Info.OprKind,Move.StepKind,Info.SerialNo,Move.DepartNo,'' as DealDepartName,Move.UserNo,'' as DealUserName,Move.DealDate from (select distinct Info.OprYear,Info.OprKind,Info.OprNo,Info.OprBrief,Info.OprMonth,Info.OprDay,Info.AppDepart,Info.AppUser,Info.EndFlag,Info.SerialNo from FMIS04.OPR@OprInformation Info ,FMIS04.OPR@OprMove Moves where Info.OprYear = Moves.OprYear and Info.OprKind = Moves.OprKind and Info.OprNo = Moves.OprNo ) as Info left join FMIS04.OPR@OprMove Move on Move.OprYear = Info.OprYear and Move.OprKind = Info.OprKind and Move.OprNo = Info.OprNo and Move.SerialNo = Info.SerialNo Left join xzfmsys.View@User User on User.UserNo = Info.AppUser Left join FMIS04.OPR@Operation Ope on Ope.OprKind = Info.OprKind order by Operation ASC ,OprNo ASC ,OprDate ASC
其中:表OPR@OprInformation 记录数:11000
OPR@OprMove 记录数:31000
其他表都很小,几十条记录
windows版的数据库是从Aix上用IXF文件的格式导出恢复到Windows平台的,主键、索引完全相同,只是丢失了外键
语句执行时windows平台立即开始返回结果,unix平台花了890秒,相差悬殊,经过测试存取处理方案查,发现两个平台采用了不同的存取处理方案,unix平台有一个索引没能使用上(就是第二次连接oprmove表时as Info left join FMIS04.OPR@OprMove Move),直接导致了查询速度慢,其他几个语句也发现了同样的问题
我试着调整数据库配置参数,没有成效,对其基本没有影响,因此肯定是索引的使用问题,本人对此很是困惑,请高人帮解
一下是数据库的配置参数:
Database Manager Configuration
Node type = Database Server with local and remote clients
Database manager configuration release level = 0x0900
CPU speed (millisec/instruction) (CPUSPEED) = 5.117063e-07
Max number of concurrently active databases (NUMDB) = 8
Data Links support (DATALINKS) = NO
Federated Database System Support (FEDERATED) = YES
Transaction processor monitor name (TP_MON_NAME) =
Default charge-back account (DFT_ACCOUNT_STR) =
Java Development Kit 1.1 installation path (JDK11_PATH) =
Diagnostic error capture level (DIAGLEVEL) = 3
Diagnostic data directory path (DIAGPATH) = /home/userid/sqllib/db2dump
Default database monitor switches
Buffer pool (DFT_MON_BUFPOOL) = OFF
Lock (DFT_MON_LOCK) = OFF
Sort (DFT_MON_SORT) = OFF
Statement (DFT_MON_STMT) = OFF
Table (DFT_MON_TABLE) = OFF
Unit of work (DFT_MON_UOW) = OFF
SYSADM group name (SYSADM_GROUP) = DB2IADM1
SYSCTRL group name (SYSCTRL_GROUP) =
SYSMAINT group name (SYSMAINT_GROUP) =
Database manager authentication (AUTHENTICATION) = SERVER
Cataloging allowed without authority (CATALOG_NOAUTH) = NO
Trust all clients (TRUST_ALLCLNTS) = YES
Trusted client authentication (TRUST_CLNTAUTH) = CLIENT
Default database path (DFTDBPATH) = /home/userid
Database monitor heap size (4KB) (MON_HEAP_SZ) = 56
UDF shared memory set size (4KB) (UDF_MEM_SZ) = 256
Java Virtual Machine heap size (4KB) (JAVA_HEAP_SZ) = 2048
Audit buffer size (4KB) (AUDIT_BUF_SZ) = 0
Backup buffer default size (4KB) (BACKBUFSZ) = 1024
Restore buffer default size (4KB) (RESTBUFSZ) = 1024
Sort heap threshold (4KB) (SHEAPTHRES) = 20000
Directory cache support (DIR_CACHE) = YES
Application support layer heap size (4KB) (ASLHEAPSZ) = 15
Max requester I/O block size (bytes) (RQRIOBLK) = 32767
Query heap size (4KB) (QUERY_HEAP_SZ) = 1000
DRDA services heap size (4KB) (DRDA_HEAP_SZ) = 128
Priority of agents (AGENTPRI) = SYSTEM
Max number of existing agents (MAXAGENTS) = 200
Agent pool size (NUM_POOLAGENTS) = 4 (calculated)
Initial number of agents in pool (NUM_INITAGENTS) = 0
Max number of coordinating agents (MAX_COORDAGENTS) = MAXAGENTS
Max no. of concurrent coordinating agents (MAXCAGENTS) = MAX_COORDAGENTS
Max number of logical agents (MAX_LOGICAGENTS) = MAX_COORDAGENTS
Keep DARI process (KEEPDARI) = YES
Max number of DARI processes (MAXDARI) = MAX_COORDAGENTS
Initialize DARI process with JVM (INITDARI_JVM) = NO
Initial number of fenced DARI process (NUM_INITDARIS) = 0
Index re-creation time (INDEXREC) = RESTART
Transaction manager database name (TM_DATABASE) = 1ST_CONN
Transaction resync interval (sec) (RESYNC_INTERVAL) = 180
SPM name (SPM_NAME) = m85_xzcw
SPM log size (SPM_LOG_FILE_SZ) = 256
SPM resync agent limit (SPM_MAX_RESYNC) = 20
SPM log path (SPM_LOG_PATH) =
TCP/IP Service name (SVCENAME) = db2cdb2inst1
APPC Transaction program name (TPNAME) =
IPX/SPX File server name (FILESERVER) =
IPX/SPX DB2 server object name (OBJECTNAME) =
IPX/SPX Socket number (IPX_SOCKET) = 879E
Discovery mode (DISCOVER) = SEARCH
Discovery communication protocols (DISCOVER_COMM) = TCPIP
Discover server instance (DISCOVER_INST) = ENABLE
Directory services type (DIR_TYPE) = NONE
Directory path name (DIR_PATH_NAME) = /.:/subsys/database/
Directory object name (DIR_OBJ_NAME) =
Routing information object name (ROUTE_OBJ_NAME) =
Default client comm. protocols (DFT_CLIENT_COMM) =
Maximum query degree of parallelism (MAX_QUERYDEGREE) = ANY
Enable intra-partition parallelism (INTRA_PARALLEL) = NO
No. of int. communication buffers(4KB)(FCM_NUM_BUFFERS) = 1024
Number of FCM request blocks (FCM_NUM_RQB) = 512
Number of FCM connection entries (FCM_NUM_CONNECT) = (FCM_NUM_RQB * 0.75)
Number of FCM message anchors (FCM_NUM_ANCHORS) = (FCM_NUM_RQB * 0.75)
Database Configuration for Database xzdcfmis
Database configuration release level = 0x0900
Database release level = 0x0900
Database territory = CN
Database code page = 1386
Database code set = GBK
Database country code = 86
Dynamic SQL Query management (DYN_QUERY_MGMT) = DISABLE
Directory object name (DIR_OBJ_NAME) =
Discovery support for this database (DISCOVER_DB) = ENABLE
Default query optimization class (DFT_QUERYOPT) = 5
Degree of parallelism (DFT_DEGREE) = 1
Continue upon arithmetic exceptions (DFT_SQLMATHWARN) = NO
Default refresh age (DFT_REFRESH_AGE) = 0
Number of frequent values retained (NUM_FREQVALUES) = 10
Number of quantiles retained (NUM_QUANTILES) = 20
Backup pending = NO
Database is consistent = YES
Rollforward pending = NO
Restore pending = NO
Multi-page file allocation enabled = NO
Log retain for recovery status = NO
User exit for logging status = NO
Data Links Token Expiry Interval (sec) (DL_EXPINT) = 60
Data Links Number of Copies (DL_NUM_COPIES) = 1
Data Links Time after Drop (days) (DL_TIME_DROP) = 1
Data Links Token in Uppercase (DL_UPPER) = NO
Data Links Token Algorithm (DL_TOKEN) = MAC0
Database heap (4KB) (DBHEAP) = 5000
Catalog cache size (4KB) (CATALOGCACHE_SZ) = 256
Log buffer size (4KB) (LOGBUFSZ) = 1024
Utilities heap size (4KB) (UTIL_HEAP_SZ) = 5000
Buffer pool size (pages) (BUFFPAGE) = 50000
Extended storage segments size (4KB) (ESTORE_SEG_SZ) = 16000
Number of extended storage segments (NUM_ESTORE_SEGS) = 0
Max storage for lock list (4KB) (LOCKLIST) = 800
Max appl. control heap size (4KB) (APP_CTL_HEAP_SZ) = 512
Sort list heap (4KB) (SORTHEAP) = 4096
SQL statement heap (4KB) (STMTHEAP) = 4096
Default application heap (4KB) (APPLHEAPSZ) = 512
Package cache size (4KB) (PCKCACHESZ) = (MAXAPPLS*
Statistics heap size (4KB) (STAT_HEAP_SZ) = 4384
Interval for checking deadlock (ms) (DLCHKTIME) = 10000
Percent. of lock lists per application (MAXLOCKS) = 22
Lock timeout (sec) (LOCKTIMEOUT) = -1
Changed pages threshold (CHNGPGS_THRESH) = 60
Number of asynchronous page cleaners (NUM_IOCLEANERS) = 1
Number of I/O servers (NUM_IOSERVERS) = 3
Index sort flag (INDEXSORT) = YES
Sequential detect flag (SEQDETECT) = YES
Default prefetch size (pages) (DFT_PREFETCH_SZ) = 32
Track modified pages (TRACKMOD) = OFF
Default number of containers = 1
Default tablespace extentsize (pages) (DFT_EXTENT_SZ) = 32
Max number of active applications (MAXAPPLS) = 200
Average number of active applications (AVG_APPLS) = 20
Max DB files open per application (MAXFILOP) = 64
Log file size (4KB) (LOGFILSIZ) = 5000
Number of primary log files (LOGPRIMARY) = 5
Number of secondary log files (LOGSECOND) = 10
Changed path to log files (NEWLOGPATH) =
Path to log files = /fmis20/userid/NODE0000/SQL00002/SQLOGDIR/
First active log file =
Group commit count (MINCOMMIT) = 1
Percent log file reclaimed before soft chckpt (SOFTMAX) = 100
Log retain for recovery enabled (LOGRETAIN) = OFF
User exit for logging enabled (USEREXIT) = OFF
Auto restart enabled (AUTORESTART) = ON
Index re-creation time (INDEXREC) = SYSTEM (RESTART)
Default number of loadrec sessions (DFT_LOADREC_SES) = 1
Number of database backups to retain (NUM_DB_BACKUPS) = 12
Recovery history retention (days) (REC_HIS_RETENTN) = 366
TSM management class (TSM_MGMTCLASS) =
TSM node name (TSM_NODENAME) =
TSM owner (TSM_OWNER) =
TSM password (TSM_PASSWORD) = |
|