前一篇文章简单分享了一些崖山数据库的情况,这里我们继续进行相关的测试和研究,以供大家参考选择。首先我们来看看有哪些参数:
SQL> EXEC DBMS_PARAM.OPTIMIZE();
PL/SQL Succeed.
SQL> SELECT DBMS_PARAM.SHOW_RECOMMEND() FROM dual;
DBMS_PARAM.SHOW_RECO
----------------------------------------------------------------
********** Recommended Settings For HEAP Table ***********
+--------------------------------+-------------+---------+
| name | recommend | restart |
+--------------------------------+-------------+---------+
| DATA_BUFFER_SIZE | 11315M | True |
| VM_BUFFER_SIZE | 1444M | True |
| WORK_AREA_STACK_SIZE | 2M | True |
| WORK_AREA_POOL_SIZE | 64M | True |
| WORK_AREA_HEAP_SIZE | 512K | True |
| SHARE_POOL_SIZE | 1444M | True |
| LARGE_POOL_SIZE | 240M | True |
| MAX_PARALLEL_WORKERS | 32 | True |
| SCOL_DATA_BUFFER_SIZE | 128M | True |
| SCOL_DATA_PRELOADERS | 2 | True |
| COLUMNAR_WORK_AREA_HEAP_SIZE | 32M | True |
| COLUMNAR_VM_BUFFER_SIZE | 128M | True |
| COLUMNAR_BULK_SIZE | 1024 | True |
| COMPRESSION | LZ4 | True |
| PQ_POOL_SIZE | 128M | True |
| MAX_SESSIONS | 1024 | True |
| MAX_WORKERS | 0 | True |
| TAB_QUEUE_WINDOW_SIZE | 4 | True |
| BLOOM_FILTER_FACTOR | 0.3 | True |
| DEGREE_OF_PARALLEL | 1 | True |
| MMS_DATA_LOADERS | 8 | True |
| CHECKPOINT_INTERVAL | 1024M | False |
| CHECKPOINT_TIMEOUT | 60 | False |
| REDOFILE_IO_MODE | SYNC | True |
| DATAFILE_IO_MODE | DEFAULT | True |
| COMMIT_LOGGING | BATCH | False |
| RECOVERY_PARALLELISM | 8 | True |
| REDO_BUFFER_SIZE | 32M | True |
+--------------------------------+-------------+---------+
Note: You can execute 'DBMS_PARAM.APPLY_RECOMMEND()' to apply the recommend parameters.
After applying the parameters, you need to restart the database.
1 row fetched.
SQL> EXEC DBMS_PARAM.APPLY_RECOMMEND();
PL/SQL Succeed.
从这一点来看,还是非常贴心的,基本上一键优化数据库参数,然后apple重启实例即可,此处点个赞。
到这里我就比较好奇,崖山数据库到底多少参数呢,参数看参数文件确实不多,只有几十个而已。这里通过查询动态试图来看看。
SQL> select * from V$FIXED_TABLE;
NAME OBJECT_ID TYPE
--------------------------------------------------------------
X$INSTANCE -129 TABLE
X$FIXED_TABLE -130 TABLE
X$FIXED_VIEW -131 TABLE
X$AXCTOPO -132 TABLE
X$SQLTEXT -133 TABLE
X$CM_TASK_INFO -134 TABLE
X$DIN_STAT -200 TABLE
X$DIN_NODE -201 TABLE
X$DIN_LINK -202 TABLE
X$DATABASE -135 TABLE
X$LOGFILE -136 TABLE
X$ARCHIVED_LOG -137 TABLE
X$ARCHIVE_DEST -138 TABLE
X$ARCHIVE_DEST_STATUS -139 TABLE
X$REPLICATION_STATUS -140 TABLE
X$ARCHIVE_GAP -141 TABLE
X$DBWR_STATS -142 TABLE
X$TABLESPACE -143 TABLE
X$REPLICATION_EVENT -144 TABLE
X$REDOSTAT -145 TABLE
X$RECOVERY_PROGRESS -146 TABLE
X$BACKUP_PROGRESS -147 TABLE
X$YFS_DISKGROUP -148 TABLE
X$YFS_DISK -149 TABLE
X$YFS_FAILGROUP -150 TABLE
X$YFS_FILE -151 TABLE
X$SPINLOCK -152 TABLE
X$SYSTEM_EVENT -153 TABLE
X$SYSTEM_WAIT_CLASS -154 TABLE
X$TEMPORARY_EXTENT_POOL -155 TABLE
X$TRANSACTION -156 TABLE
X$UNDO_SEGMENTS -157 TABLE
X$TEMPORARY_SEGMENT -158 TABLE
X$TABLE_DICTIONARY -159 TABLE
X$CONTROLFILE -160 TABLE
X$HM_RUN -161 TABLE
X$HM_FINDING -162 TABLE
X$HM_CHECK_PARAM -163 TABLE
X$HM_CHECK -164 TABLE
X$DIAG_PROBLEM -165 TABLE
X$DIAG_INCIDENT -166 TABLE
X$DIAG_FAULT -167 TABLE
X$SQLTEXT -133 TABLE
X$SHARE_POOL -168 TABLE
X$SGASTAT -169 TABLE
X$SGA -170 TABLE
X$SESSION_WAIT -171 TABLE
X$SESSION -172 TABLE
X$ROLLBACK -173 TABLE
X$PRIVATE_TEMP_TABLES -174 TABLE
X$LSC_XFMR_SLICES -175 TABLE
X$COLUMNAR_MEM_CACHE -176 TABLE
X$CHANNEL_PERF -177 TABLE
X$CHECKPOINT -178 TABLE
X$BUFFER_POOL_STATISTICS -179 TABLE
X$BUFFER_POOL -180 TABLE
X$BUFFER_CONTROL -181 TABLE
X$BUFFER_ACCESS_STATISTICS -182 TABLE
X$LOCKED_OBJECT -183 TABLE
X$LOCK -184 TABLE
X$LARGE_POOL -185 TABLE
X$HOT_CACHE -186 TABLE
X$DISKCACHE -187 TABLE
X$DICT_CACHE -188 TABLE
X$CORRUPTED_TABLE -189 TABLE
X$COLUMNAR_MEM_POOL -190 TABLE
X$CLUSTER_MESSAGE -199 TABLE
X$CLUSTER_MESSAGE_POOL -198 TABLE
X$CLUSTER_MESSAGE_STAT -197 TABLE
X$CLUSTER_TASK_STAT -196 TABLE
X$GLS_LOCK -195 TABLE
X$GRC_DHTRULE -194 TABLE
X$GRC_PASTCOPY -193 TABLE
X$GRC_RESOURCE -192 TABLE
X$RESOURCE_REQUEST -191 TABLE
X$DATA_CONNECTION -203 TABLE
X$COL_CODEC_DICT_VALUES -204 TABLE
X$2PC_PENDING -205 TABLE
X$NODE -206 TABLE
X$ELECTION -207 TABLE
X$CM_NODE_INFO -208 TABLE
X$CM_GROUP_INFO -209 TABLE
X$CM_CLUSTER_INFO -210 TABLE
X$ALLOCATOR -211 TABLE
X$PUB_STAT -212 TABLE
X$LSC_SLICE_STAT -213 TABLE
X$TASK -214 TABLE
X$OSSTAT -215 TABLE
X$PLANCACHE -216 TABLE
X$PARAMETER -217 TABLE
X$VISIBLE_PARAMETER -218 TABLE
X$SYSSTAT -219 TABLE
X$MYSTAT -220 TABLE
X$SESSTAT -221 TABLE
X$STATNAME -222 TABLE
X$AUDITABLE_SYSTEM_ACTIONS -223 TABLE
X$AUDITABLE_OBJECT_ACTIONS -224 TABLE
X$OPEN_CURSOR -226 TABLE
X$PX_WORKER -227 TABLE
X$PX_SESSION -228 TABLE
X$PQ_TQSTAT -229 TABLE
X$SESSION_WORKER -230 TABLE
X$PROCESS -231 TABLE
X$COM_WORKER -225 TABLE
X$WINDOW_FUNCTION -232 TABLE
X$SQL_TRACE -233 TABLE
X$SQL_PLAN_TRACE -234 TABLE
X$SQL_PLAN_STATISTICS -235 TABLE
X$SQL_PLAN -236 TABLE
X$DATATYPE -238 TABLE
X$DML_STATS -239 TABLE
X$ERROR_CODE -240 TABLE
X$FUNCTION -241 TABLE
X$GLOBAL_MPOOL -242 TABLE
X$RESERVED_WORDS -243 TABLE
X$DYNAMIC_VIEWS -244 TABLE
X$VERSION -237 TABLE
X$SQL -245 TABLE
X$SQLAREA -246 TABLE
X$SQLSTATS -247 TABLE
X$VM -248 TABLE
X$VMSTAT -249 TABLE
X$CPUSTAT -250 TABLE
X$DATAFILE -251 TABLE
X$DATABUCKET -252 TABLE
X$SESSION_ROLES -253 TABLE
X$UNDOSTAT -254 TABLE
X$DICT_CURSOR -255 TABLE
X$ALERT_EVENT -256 TABLE
X$DUAL -257 TABLE
V$INSTANCE -2049 VIEW
GV$INSTANCE -2050 VIEW
V$FIXED_TABLE -2051 VIEW
GV$FIXED_TABLE -2052 VIEW
V$FIXED_VIEW_DEFINITION -2053 VIEW
GV$FIXED_VIEW_DEFINITION -2054 VIEW
V$SQL_PLAN_TRACE -2055 VIEW
GV$SQL_PLAN_TRACE -2056 VIEW
V$CM_TASK_INFO -2057 VIEW
GV$CM_TASK_INFO -2058 VIEW
V$DIN_STAT -2177 VIEW
GV$DIN_STAT -2178 VIEW
V$DIN_NODE -2179 VIEW
GV$DIN_NODE -2180 VIEW
V$DIN_LINK -2181 VIEW
GV$DIN_LINK -2182 VIEW
V$DATABASE -2059 VIEW
V$LOGFILE -2060 VIEW
V$ARCHIVED_LOG -2061 VIEW
V$ARCHIVE_DEST -2062 VIEW
GV$ARCHIVE_DEST -2063 VIEW
V$ARCHIVE_DEST_STATUS -2064 VIEW
GV$ARCHIVE_DEST_STATUS -2065 VIEW
V$REPLICATION_STATUS -2066 VIEW
V$ARCHIVE_GAP -2067 VIEW
V$DBWR_STATISTICS -2068 VIEW
GV$DBWR_STATISTICS -2069 VIEW
V$TABLESPACE -2070 VIEW
V$REPLICATION_EVENT -2071 VIEW
GV$REPLICATION_EVENT -2072 VIEW
V$REDOSTAT -2073 VIEW
GV$REDOSTAT -2074 VIEW
V$RECOVERY_PROGRESS -2075 VIEW
GV$RECOVERY_PROGRESS -2076 VIEW
V$BACKUP_PROGRESS -2077 VIEW
GV$BACKUP_PROGRESS -2078 VIEW
V$YFS_FILE -2079 VIEW
V$YFS_FAILGROUP -2080 VIEW
V$YFS_DISKGROUP -2081 VIEW
V$YFS_DISK -2082 VIEW
V$SPINLOCK -2083 VIEW
GV$SPINLOCK -2084 VIEW
V$SYSTEM_EVENT -2085 VIEW
GV$SYSTEM_EVENT -2086 VIEW
V$SYSTEM_WAIT_CLASS -2087 VIEW
GV$SYSTEM_WAIT_CLASS -2088 VIEW
V$TEMP_EXTENT_POOL -2089 VIEW
GV$TEMP_EXTENT_POOL -2090 VIEW
V$TRANSACTION -2091 VIEW
GV$TRANSACTION -2092 VIEW
V$UNDO_SEGMENTS -2093 VIEW
GV$UNDO_SEGMENTS -2094 VIEW
V$TEMPORARY_SEGMENT -2095 VIEW
GV$TEMPORARY_SEGMENT -2096 VIEW
V$TABLE_DICTIONARY -2097 VIEW
GV$TABLE_DICTIONARY -2098 VIEW
V$CONTROLFILE -2099 VIEW
V$HM_RUN -2100 VIEW
GV$HM_RUN -2101 VIEW
V$HM_FINDING -2102 VIEW
GV$HM_FINDING -2103 VIEW
V$HM_CHECK_PARAM -2104 VIEW
GV$HM_CHECK_PARAM -2105 VIEW
V$HM_CHECK -2106 VIEW
GV$HM_CHECK -2107 VIEW
V$DIAG_PROBLEM -2108 VIEW
GV$DIAG_PROBLEM -2109 VIEW
V$DIAG_INCIDENT -2110 VIEW
GV$DIAG_INCIDENT -2111 VIEW
V$DIAG_FAULT -2112 VIEW
GV$DIAG_FAULT -2113 VIEW
V$SHARE_POOL -2114 VIEW
GV$SHARE_POOL -2115 VIEW
V$SGASTAT -2116 VIEW
GV$SGASTAT -2117 VIEW
V$SGA -2118 VIEW
GV$SGA -2119 VIEW
V$SESSION_WAIT -2120 VIEW
GV$SESSION_WAIT -2121 VIEW
V$SESSION -2122 VIEW
GV$SESSION -2123 VIEW
......
V$UNDOSTAT -2279 VIEW
GV$UNDOSTAT -2280 VIEW
V$DICT_CURSOR -2281 VIEW
GV$DICT_CURSOR -2282 VIEW
V$ALERT_EVENT -2283 VIEW
GV$ALERT_EVENT -2284 VIEW
DUAL -2285 VIEW
从V$FIXED_TABLE 来看,还是不少,有367个,去掉其中gv$部分也还有180多个,还是不少了(x$FIXED_TABLE也是Oracle才有的东西). 从这里来看,崖山数据库确实下了不少功夫呀!进一步来看看参数情况:
SQL> select name,value from v$parameter;
NAME VALUE
---------------------------------------- ----------------------------------------------------------------
MAX_SESSIONS 1024
MAX_WORKERS 0
MAX_PARALLEL_WORKERS 32
MAX_REACTOR_CHANNELS 0
WORK_AREA_STACK_SIZE 2M
RUN_LOG_LEVEL INFO
RUN_LOG_FILE_COUNT 10
RUN_LOG_FILE_SIZE 20M
RUN_LOG_FILE_PATH /home/yashan/yasdb_home/yashandb/23.1.1.100/log/yashantest/db-1-1/run
USE_LARGE_PAGES FALSE
CONTROL_FILES ('/home/yashan/yasdb_home/yashandb/data/yashantest/db-1-1/dbfiles/ctrl1',
'/home/yashan/yasdb_home/yashandb/data/yashantest/db-1-1/dbfiles/ctrl2',
'/home/yashan/yasdb_home/yashandb/data/yashantest/db-1-1/dbfiles/ctrl3')
DB_BLOCK_SIZE 8192
DATA_BUFFER_SIZE 8709M
WORK_AREA_HEAP_SIZE 512K
WORK_AREA_POOL_SIZE 64M
HA_HEARTBEAT_INTERVAL 3
HA_ELECTION_TIMEOUT 9
HA_ELECTION_ENABLED FALSE
HA_ELECTION_LEADER_LEASE_ENABLED FALSE
REDO_BUFFER_SIZE 32M
REDO_BUFFER_PARTS 4
LARGE_POOL_SIZE 176M
MAX_PRIVATE_TEMP_TABLES 16
VM_BUFFER_SIZE 1111M
DBWR_BUFFER_SIZE 4M
UNDO_RETENTION 300
UNDO_SHRINK_ENABLED TRUE
UNDO_SHRINK_INTERVAL 3600
TRANSACTION_LOCK_TIMEOUT 0
DDL_LOCK_TIMEOUT 0
STARTUP_ROLLBACK_PARALLELISM 2
ISOLATION_LEVEL READ_COMMITTED
COMMIT_WAIT WAIT
COMMIT_LOGGING BATCH
RECOVERY_PARALLELISM 8
CHECKPOINT_INTERVAL 256M
CHECKPOINT_TIMEOUT 60
LISTEN_ADDR 172.20.22.146:1688
REPLICATION_ADDR 172.20.22.146:1689
CHARACTER_SET UTF8
NATIONAL_CHARACTER_SET UTF16
DBWR_COUNT 2
DB_FILE_NAME_CONVERT
REDO_FILE_NAME_CONVERT
DB_BUCKET_NAME_CONVERT
ARCHIVE_LOCAL_DEST ?/archive
ARCHIVE_DEST_1
......
ARCHIVE_DEST_32
QUORUM_SYNC_STANDBYS MAJORITY
REQUIRED_SYNC_STANDBYS
DATAFILE_IO_MODE DEFAULT
REDOFILE_IO_MODE DSYNC
DOUBLE_WRITE_ENABLED TRUE
DEFAULT_TABLE_TYPE HEAP
MMS_USE_LARGE_PAGES FALSE
MMS_DATA_LOADERS 8
ARCH_CLEAN_UPPER_THRESHOLD 16G
ARCH_CLEAN_LOWER_THRESHOLD 12G
ARCH_CLEAN_IGNORE_MODE NONE
DATE_FORMAT yyyy-mm-dd
TIME_FORMAT hh24:mi:ss.ff
TIMESTAMP_FORMAT yyyy-mm-dd hh24:mi:ss.ff
YMINTERVAL_FORMAT yy-mm
DSINTERVAL_FORMAT dd hh24:mi:ss.ff
PASSWORD_FILE ?/instance/yasdb.pwd
SQL_PLUGIN NONE
SCOL_DATA_BUFFER_SIZE 128M
SCOL_CACHEABLE_SCAN_ROWS 18446744073709551615
SCOL_DISK_CACHEABLE_SCAN_ROWS 18446744073709551615
SCOL_DATA_PRELOADERS 2
RECYCLEBIN_ENABLED OFF
COLUMNAR_VM_BUFFER_SIZE 128M
COLUMNAR_MATERIAL_PERCENT 80
COLUMNAR_WORK_AREA_HEAP_SIZE 32M
DB_BLOCK_CHECKSUM TYPICAL
BLOCK_REPAIR_ENABLED TRUE
BLOCK_REPAIR_TIMEOUT 60
COMPRESSION LZ4
COMPRESSION_LEVEL LOW
OPTIMIZER_DYNAMIC_SAMPLING 0
LSC_DICTIONARY_CACHE_AUTOEXTEND FALSE
BUCKET_RESERVED_SPACE 1G
DIAGNOSTIC_DEST ?/diag
DIAG_ADR_ENABLED TRUE
COLUMNAR_BULK_SIZE 1024
DEGREE_OF_PARALLEL 1
QUERY_REWRITE_ENABLED FALSE
NODE_ID 1-1:1
CM_ADDR 1-1:1/127.0.0.1:1679
DIN_ADDR 127.0.0.1:1690
DIN_RECONNECT_TIME 5000
DEFAULT_MCOL_TTL 3600
SCOL_WRITE_CACHE_POLICY WRITE_BACK
DS_SCALE_OUT_FACTOR 7
STATISTICS_LEVEL TYPICAL
UNIFIED_AUDITING FALSE
SHARE_POOL_SIZE 1111M
CGROUP_FLAG 0
CGROUP_ROOT_DIR /sys/fs/cgroup
RESOURCE_MANAGER_PLAN
JOB_QUEUE_PROCESSES 16
OPEN_CURSORS 310
LSNR_LOG ON
JVM_XMS 512M
JVM_XMX 512M
CLUSTER_DATABASE FALSE
INSTANCE_NAME yasdb
CLUSTER_INTERCONNECT 127.0.0.1:1700
INTERCONNECT_LINKS 2
INTERCONNECT_MESSAGE_POOL 1024:64;512:8800;128:16800;64:32800
INTERCONNECT_RECEIVE_TIMEOUT 5
GRC_TASK_COUNT 2
GCS_TASK_COUNT 3
GLS_TASK_COUNT 2
CLUSTER_SERVICE
CLUSTER_RECONNECT_TIME 5000
YASFS_DATA_DIR +DG0
SESSION_MAX_OPEN_FILES 50
AC_MAX_SOURCE_SLICE_COUNT 20
AC_SLICE_THRESHOLD_SIZE 64M
SSL_CERT_FILE
SSL_KEY_FILE
SSL_DH_PARAM_FILE
SSL_ENABLE OFF
ENABLE_SEPARATE_DUTY FALSE
BLOOM_FILTER_FACTOR .3
ENABLE_SLOW_LOG FALSE
SLOW_LOG_TIME_THRESHOLD 1000
SLOW_LOG_FILE_NAME slow.log
SLOW_LOG_FILE_PATH /home/yashan/yasdb_home/yashandb/23.1.1.100/log/yashantest/db-1-1/slow
SLOW_LOG_OUTPUT FILE
SLOW_LOG_SQL_MAX_LEN 2000
AUDIT_QUEUE_WRITE TRUE
AUDIT_QUEUE_SIZE 16M
AUDIT_FLUSH_INTERVAL 100
TAB_QUEUE_WINDOW_SIZE 4
DATA_RETENTION 3600
DATA_TRANSFORMER_ENABLED TRUE
SCOL_SLICE_ROWS 8M
COLUMNAR_VM_SWAP_SIZE 200G
BROADCAST_GTS_TIME 5
HA_SSL_ENABLE OFF
EXTSERVER_CONNS 64
DBWR_FLUSH_NEIGHBORS_COUNT 16
ENABLE_DISKCACHE FALSE
ENABLE_ARCH_DATA_IGNORE_BACKUP FALSE
SQL_MAP FALSE
177 rows fetched.
说明崖山23.1版本有177个参数。那么是否也有类似Oracle 一样的隐含参数呢? 这里我们继续查一下x$试图来看看,是否有所发现:
SQL> select name,value from X$PARAMETER order by 1;
NAME VALUE
---------------------------------------------- --------------------------------
AUDIT_SYS_OPERATIONS FALSE
COLUMNAR_BULK_COUNT 3500
COLUMNAR_LOG_TRACE FALSE
COLUMNAR_MATERIAL_TRACE FALSE
COLUMNAR_MAX_JOIN_MEM 512M
COLUMNAR_MAX_OPERATOR_MEM_PERCENT 50
COLUMNAR_MAX_SORT_MEM 512M
COLUMNAR_MAX_STAGE_MEM_PERCENT 10
COLUMNAR_MIN_OPERATOR_MEM_PERCENT 1
COLUMNAR_NON_COLLIDING_HASH TRUE
CONTROL_ADDR 127.0.0.1:1689
COST_INDEX_FULL_SCAN_MIN_MAX -1.0
CURRENT_SCHEMA
CURSOR_POOL_SIZE 32M
DERM_ENABLED FALSE
DERM_PARALLEL_EXECUTIONS 50
DICTIONARY_CACHE_SIZE 25
DIN_CONNECTIONS_PER_NODE 5
DSTB_POOL_SIZE 0
LOCK_POOL_SIZE 32M
MAX_PARALLELISMS 0
MAX_PARALLELISMS_PER_EXEC 0
MAX_VM_OPEN 128
MEX_POOL_SIZE 512M
PACKET_SIZE 128K
PQ_POOL_SIZE 128M
RCY_DDL_TEST
SQL_POOL_PARTS 1
SQL_POOL_SIZE 50
THREAD_STACK_SIZE 1024K
TIMESTAMP_TZ_FORMAT yyyy-mm-dd hh24:mi:ss.ff AM TZH:TZM TZH:TZM
USE_STORED_OUTLINES FALSE
VM_BUFFER_PARTS 1
VM_BUFFER_SWAP_TIMES 1024
_ARCHIVE_DELAY_TIME 0
_ARCH_AUTO_CELAN_DATA_NUM 100
_ARCH_DATA_THRESHOLD 1000000
_BATCH_COMMIT_DELAY 0
_BUCKET_VALUE_SCALE_IN_HASH_SET 1
_BUCKET_VALUE_SCALE_IN_HASH_TABLE 1
_BULKLOAD_WITH_SCOL_DATA_BUFFER ON
_CHECK_PASSWORD_COMPLEXITY FALSE
_CHN_MAX_SEGMENT_SIZE 64K
_CLUSTER_ID 6553362c3d3cec527b2adf3484e0952c
_CLUSTER_MESSAGE_LOG_ENABLED OFF
_COAST_SIMD_MODE SIMD_MODE_512
_COLUMNAR_DYNAMIC_ARRAY_THRESHOLD 4000000
_COLUMNAR_ENABLE_HASH_GROUP_DISTINCT TRUE
_COLUMNAR_MAX_BATCH_COUNT 1024
_COLUMNAR_MAX_HASH_BUCKET 40000000
_COLUMNAR_ROWGROUP_ROWS 4k
_COL_MEM_POOL_EVICT_ENABLED TRUE
_COL_RUNTIME_FILTER_USE_PRECISE_ROWS TRUE
_CONSISTENT_WRITE FALSE
_COST_AC_SCAN -1.0
_COST_GROUP -1.0
_COST_HASH_GROUP -1.0
_COST_HASH_JOIN -1.0
_COST_IDX_NL_JOIN -1.0
_COST_INDEX_FAST_FULL_SCAN -1.0
_COST_INDEX_FULL_SCAN -1.0
_COST_INDEX_RANGE_SCAN -1.0
_COST_INDEX_RANGE_SCAN_MIN_MAX -1.0
_COST_INDEX_SCAN -1.0
_COST_INDEX_SKIP_SCAN -1.0
_COST_INDEX_UNIQUE_SCAN -1.0
_COST_MS_JOIN -1.0
_COST_MULTI_TO_MULTI -1.0
_COST_MULTI_TO_MULTI_BCST -1.0
_COST_MULTI_TO_SGL -1.0
_COST_NL_JOIN -1.0
_COST_ORDER_BY -1.0
_COST_PART_AC_SCAN -1.0
_COST_PART_ALL_AC_SCAN -1.0
_COST_PART_ALL_SCAN -1.0
_COST_PART_INDEX_SCAN -1.0
_COST_PART_ITER_AC_SCAN -1.0
_COST_PART_ITER_SCAN -1.0
_COST_PART_MULTICOL_SCAN -1.0
_COST_PART_SCAN -1.0
_COST_PART_SINGLE_AC_SCAN -1.0
_COST_PART_SINGLE_SCAN -1.0
_COST_PX_QUEUE -1.0
_COST_ROWID_SCAN -1.0
_COST_RTREE_SCAN -1.0
_COST_SDT -1.0
_COST_SDT_GROUP -1.0
_COST_SGL_TO_MULTI -1.0
_COST_SGL_TO_MULTI_BCST -1.0
_COST_SGL_TO_SGL -1.0
_COST_SORT -1.0
_COST_SORTED_WINFUNC -1.0
_COST_SORT_AGGRDIST -1.0
_COST_SORT_GROUP -1.0
_COST_TABLE_FULL_SCAN -1.0
_COST_UNIQUE -1.0
_DATA_BUFFER_PARTS 1
_DATA_TRANSFORMER_MAX_TASK_COUNT 200K
_DATA_TRANSFORMER_SCHEDULING_TIME 300
_DATA_TRANSFORMER_WORKERS 32
_DBWR_SORT_ENABLED ON
_DB_BLOCK_MAX_CR_DBA 5
_ENABLE_ALTER_SLICE FALSE
_ENABLE_CREATE_AC_BTREE FALSE
_ENABLE_DISTRIBUTE_TRANSACTION FALSE
_ENABLE_EXPLAIN_STATS TRUE
_ENABLE_HEAP TRUE
_ENABLE_INDEX TRUE
_ENABLE_LSC TRUE
_ENABLE_OLD_DECIMAL FALSE
_ENABLE_REDO_TRAFFIC_CONTROL FALSE
_ENABLE_S3 FALSE
_ENABLE_TAC TRUE
_FAULT_POINT
_GCS_REQ_CLEAN_INTERVAL 30
_HA_ELECTION_VOTE_FOR_PRE_CANDIDATE_INTERVAL 50
_HOT_BUFFER_PCT 60
_HOT_CACHE_SIZE 16M
_LATEST_RESET_ID -1
_MCOL_CACHE_REFRESH_SIZE 100
_MCOL_SLICE_ROWS 2M
_MIGRATION_MODE_ENABLED OFF
_OM_ELECTION_ENABLE FALSE
_OPTIMIZER_MODE CBO
_OPTIMIZE_EXTEND_FILTER TRUE
_OPTMZ_EARLY_GROUP_OPT ON
_OPTMZ_ENABLE_DSTB_AC TRUE
_OPTMZ_ENABLE_DUP_TABLE_PARALLEL TRUE
_OPTMZ_EXEC_ENGINE UNSPECIFIED
_OPTMZ_MINMAX_OPT SINGLE
_PROMOTE_NUMBER FALSE
_PX_SENDER_PROJECT FALSE
_RCY_BPWR_COUNT 0
_REDO_FLUSH_TRIGGERED_DELAY 1
_REMOTE_CR_THRESHOLD 4
_REPLICATION_BUFFER_SIZE 16M
_RWRT_OPT 255
_SCOL_EXTENT_SIZE 1M
_SCOL_FILTER_MODE FILTER_ROW
_SCOL_MANAGER_CAPACITY 32767
_SCOL_SLICE_LAYOUT SILO
_SESSION_RESERVED_CURSORS 8
_SESSION_RESERVED_LOCKS 16
_SESSION_TEMP_TABLE_CACHE_SIZE 1K
_SLOW_LOG_EPOCH_SIZE 64
_SLOW_LOG_QUEUE_SIZE 256
_SPAREINDEX_OPT ON
_SPLIT_BRAIN_DATA_LIMIT 4G
_SQL_MAP FALSE
_STANDBY_MAX_FAILURE_TIMEOUT 300
_TAC_FILTER_PUSH_THRESHOLD 5
_TEMP_BUFFER_PCT 20
_TWO_PHASE_FETCH_THRESHOLD 75
_UNDO_FORCE_RETENTION FALSE
_UNDO_MAX_AUTOEXTEND_SEGMENTS 64
_UNDO_SEG_BUSY_TIMES 2
_UNDO_SEG_EXTEND_INTERVAL 600
_USE_OPTMZ_INFO FALSE
_WAIT_BOC TRUE
_XACT_UNDO_TIMES 20
虽然参数并不太多;但是还是有不少隐含参数,应该也是类似Oracle,通过隐含参数来启用或关闭一些特殊的功能,默认值如果是false的,通常说明是不稳定的功能。从上面的隐含参数,我们可以发现不少有意思的地方:
SQL> select * from x$parameter where name like '%INDEX%';
NAME VALUE DEFAULT_VALUE
---------------------------------- ------------------ -------------------
_ENABLE_INDEX TRUE TRUE
_SPAREINDEX_OPT ON ON
_COST_INDEX_UNIQUE_SCAN -1.0 -1
_COST_INDEX_FULL_SCAN -1.0 -1
_COST_INDEX_RANGE_SCAN -1.0 -1
_COST_INDEX_RANGE_SCAN_MIN_MAX -1.0 -1
COST_INDEX_FULL_SCAN_MIN_MAX -1.0 -1
_COST_INDEX_FAST_FULL_SCAN -1.0 -1
_COST_INDEX_SKIP_SCAN -1.0 -1
_COST_INDEX_SCAN -1.0 -1
_COST_PART_INDEX_SCAN -1.0 -1
我们可以看到崖山数据库居然支持Index fast full scan;目前opengauss和达梦好像都还在不支持,这里简单验证一下。
SQL> create table t17 as select * from sys.dba_objects;
Succeed.
SQL> insert into t17 select * from t17;
1357 rows affected.
......
SQL> insert into t17 select * from t17;
694784 rows affected.
SQL> commit;
Succeed.
SQL> create index idx_t17_owner on t17(owner) parallel 4;
Succeed.
SQL> alter index idx_t17_owner noparallel;
Succeed.
SQL> alter index idx_t17_owner rebuild online;
Succeed.
SQL>
SQL> BEGIN
2 DBMS_STATS.GATHER_TABLE_STATS('ENMO', 'T17', 1, FALSE, 'FOR ALL COLUMNS SIZE AUTO', 4, 'AUTO', TRUE);
3 END;
/ 4
YAS-04253 PL/SQL compiling errors:
[2:5] YAS-04401 data type STRING expected, but INTEGER got
SQL> BEGIN
2 DBMS_STATS.GATHER_TABLE_STATS('ENMO', 'T17', '', 1, FALSE, 'FOR ALL COLUMNS SIZE AUTO', 4, 'AUTO', TRUE);
3 END;
/ 4
PL/SQL Succeed.
SQL>
从上面测试可以看到,统计信息收集时遇到了一个小Bug,居然不支持单表,支持分区表,对于非分区表也必须指定‘’选项才行。不得不说,跟Oracle非常像,连dbms_stats都有了,看官方文档的用法也差不多。
SQL> set autot on
SQL> select owner,count(1) from t17 group by owner order by 1;
OWNER COUNT(1)
---------------------------------------------- ----------
ENMO 1024
MDSYS 4096
PUBLIC 549888
SYS 834560
Execution Plan
----------------------------------------------------------------
SQL hash value: 2300714586
Optimizer: ADOPT_C
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| Id | Operation type | Name | Owner | E - Rows | A - Rows | Cost(%CPU) | A - Time | Loops | Memory | Disk | Partition info |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| 0 | SELECT STATEMENT | | | | | | | | | | |
| 1 | SORT GROUP | | | 4| | 455( 0)| | | | | |
| 2 | INDEX FAST FULL SCAN | IDX_T17_OWNER | ENMO | 1389568| | 385( 0)| | | | | |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
Operation Information (identified by operation id):
---------------------------------------------------
1 - Group Expression: ("T17"."OWNER")
Statistics
----------------------------------------------------------------------------------------------------
19 rows fetched.
SQL>
SQL> select /*+NO_INDEX_FFS(a IDX_T17_OWNER) */ owner,count(1) from t17 a group by owner order by 2;
OWNER COUNT(1)
-------------------------------------- ---------------------
ENMO 1024
MDSYS 4096
PUBLIC 549888
SYS 834560
Execution Plan
----------------------------------------------------------------
SQL hash value: 3609744365
Optimizer: ADOPT_C
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| Id | Operation type | Name | Owner | E - Rows | A - Rows | Cost(%CPU) | A - Time | Loops | Memory | Disk | Partition info |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| 0 | SELECT STATEMENT | | | | | | | | | | |
| 1 | SORT | | | 4| | 484( 0)| | | | | |
| 2 | SORT GROUP | | | 4| | 472( 0)| | | | | |
| 3 | INDEX FULL SCAN | IDX_T17_OWNER | ENMO | 1389568| | 402( 0)| | | | | |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
Operation Information (identified by operation id):
---------------------------------------------------
2 - Group Expression: ("A"."OWNER")
Statistics
----------------------------------------------------------------------------------------------------
20 rows fetched.
我们可以看到,确实支持Index fast full scan及index full scan;相关hint用法也非常类似。不过从这里来看,执行计划信息显示不完整,statistics部分无法展示,不知道算不算bug。
从前面参数来看,崖山也支持hash join;所以我想崖山的hash join性能跟oracle比如何呢?最后测一下并进行下对比。
#yashanDB
SQL> set autot on
SQL> set autot off
SQL> select count(1) from t17;
COUNT(1)
---------------------
1389568
1 row fetched.
Elapsed: 00:00:00.123
SQL> select count(1) from t17_1;
COUNT(1)
---------------------
499999
1 row fetched.
Elapsed: 00:00:00.048
SQL> set autot on
SQL> select b.owner, count(*)
2 from t17 a, t17_1 b
3 where a.object_id = b.object_id
4 group by b.owner;
OWNER COUNT(*)
------------------------------------ ---------------------
ENMO 1048576
MDSYS 4194304
PUBLIC 506756096
Execution Plan
----------------------------------------------------------------
SQL hash value: 1577418467
Optimizer: ADOPT_C
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| Id | Operation type | Name | Owner | E - Rows | A - Rows | Cost(%CPU) | A - Time | Loops | Memory | Disk | Partition info |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
| 0 | SELECT STATEMENT | | | | | | | | | | |
| 1 | SORT GROUP | | | 3| | 27293( 0)| | | | | |
|* 2 | HASH JOIN INNER | | | 511998112| | 7867( 0)| | | | | |
| 3 | TABLE ACCESS FULL | T17_1 | ENMO | 499999| | 568( 0)| | | | | |
| 4 | TABLE ACCESS FULL | T17 | ENMO | 1389568| | 1308( 0)| | | | | |
+----+--------------------------------+----------------------+------------+----------+----------+-------------+----------+----------+----------+----------+--------------------------------+
Operation Information (identified by operation id):
---------------------------------------------------
1 - Group Expression: ("B"."OWNER")
2 - Predicate : access("B"."OBJECT_ID" = "A"."OBJECT_ID")
Statistics
----------------------------------------------------------------------------------------------------
21 rows fetched.
Elapsed: 00:03:22.044
SQL>
两个测试表数据分别为138w、49w,执行时间大概是3分22秒,也就是200秒左右。
#Oracle 11204
SQL> create table t17 as select * from sys.dba_objects;
Table created.
.....
SQL> select count(1) from t17;
COUNT(1)
----------
1388000
SQL> create table t17_1 as select * from t17 where rownum < 500000;
Table created.
SQL> analyze table t17 compute statistics;
Table analyzed.
SQL> c/t17/t17_1
1* analyze table t17_1 compute statistics
SQL> /
Table analyzed.
SQL> select * from v$version where rownum < 2;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
Elapsed: 00:00:00.00
SQL> set autot on
SQL> set lines 200
SQL> select b.owner, count(*)
2 from t17 a, t17_1 b
where a.object_id = b.object_id
3 4 group by b.owner;
OWNER COUNT(*)
------------------------------ ----------
OWBSYS_AUDIT 960
MDSYS 160720
ZB_TEST 80
ROGER 2560
PUBLIC 3184752
......
SYS 3629216
WMSYS 31968
SI_INFORMTN_SCHEMA 640
TEST1 80
29 rows selected.
Elapsed: 00:00:01.72
Execution Plan
----------------------------------------------------------
Plan hash value: 3832458698
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 29 | 377 | | 9101 (3)| 00:01:50 |
| 1 | HASH GROUP BY | | 29 | 377 | | 9101 (3)| 00:01:50 |
|* 2 | HASH JOIN | | 7999K| 99M| 10M| 8876 (1)| 00:01:47 |
| 3 | TABLE ACCESS FULL| T17_1 | 499K| 4394K| | 1939 (1)| 00:00:24 |
| 4 | TABLE ACCESS FULL| T17 | 1388K| 5421K| | 5363 (1)| 00:01:05 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("A"."OBJECT_ID"="B"."OBJECT_ID")
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
26909 consistent gets
0 physical reads
0 redo size
1264 bytes sent via SQL*Net to client
535 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
29 rows processed
Oracle 居然在1.7s跑出结果了,有点震惊。这样粗略算一下相差117倍 ???
当然写这篇文章没有其他的含义,不是为了贬低,希望后续能不断改进。
最后简单总结一下:
1、大量兼容Oracle的x$、v$、dba_xxx等试图,兼容性较高。
2、支持索引并行创建,online rebuild、index fast full scan等。
3、统计信息收集也非常符合oracle dba的使用习惯,因为几乎一致。
4、从测试hash join来看,似乎性能不太理想,看来基础算子的性能提升还是任重道远。