o. storage engine
原文地址:https://mariadb.com/kb/zh-cn/aria-storage-engine/
Aria 存储引擎
Aria 存储引擎是默认被编译进MariaDB 5.1里的,并且在mysqld启动的时候就要求同时启动.
另外,内部的磁盘表是Aria表格式而不是MyISAM表格式.这将使某些GROUP BY
和DISTINCT
请求速度更快,因为Aria有比MyISAM更好的缓冲机制.包含Aria是MariaDB 5.1和MySQL 5.1之间的一个不同.
There are also some new options to CREATE TABLE
:
TRANSACTIONAL= 0
: Transactional means crash-safe for Aria|
1PAGE_CHECKSUM= 0
: If index and data should use page checksums for extra safety.|
1TABLE_CHECKSUM= 0
: Same as|
1CHECKSUM
in MySQL 5.1ROW_FORMAT=PAGE
: The new cacheable row format for Aria tables. Default row format for Aria tables and only row format that can be used ifTRANSACTIONAL=1
. To emulate MyISAM, useROW_FORMAT=FIXED
orROW_FORMAT=DYNAMIC
CHECKSUM TABLE
now ignores values in NULL fields. This makesCHECKSUM TABLE
faster and fixes some cases where same table definition could give different checksum values depending on row format. The disadvantage is that the value is now different compared to other MySQL installations. The new checksum calculation is fixed for all table engines that uses the default way to calculate and MyISAM which does the calculation internally. Note: Old MyISAM tables with internal checksum will return the same checksum as before. To fix them to calculate according to new rules you have to do anALTER TABLE
. You can use the old ways to calculate checksums by using the option--old
to mysqld or set the system variable '@@old
' to1
when you doCHECKSUM TABLE ... EXTENDED;
- At startup Aria will check the Aria logs and automatically recover the tables from last checkpoint if mysqld was not taken down correctly.
mysqld startup options for Aria
Option | Description | Default value |
---|---|---|
--aria[=#] | Enable or disable Aria plugin. Possible values are ON , OFF ,FORCE (don't start if the plugin fails to load). | ON |
--aria-block-size=# | Block size to be used for Aria index pages. | 8192 |
--aria-checkpoint-interval=# | Interval between automatic checkpoints, in seconds; 0 means 'no automatic checkpoints' which makes sense only for testing. | 30 |
| Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature. | 0 |
--aria-group-commit=# | Specifies Aria group commit mode. Possible values are "none " (no group commit), "hard " (with waiting to actual commit), "soft " (no wait for commit (DANGEROUS!!!)) | none |
--aria-group-commit-interval=# | Interval between commits in microseconds (1/1000000 second). 0 stands for no waiting for other threads to come and do a commit in "hard " mode and no sync()/commit at all in "soft " mode. Option has only an effect ifaria_group_commit is used | 0 |
--aria-log-dir-path=name | Path to the directory where to store transactional log | Same as 'datadir ' |
--aria-log-file-size=# | Limit for transaction log size | 1073741824 |
--aria-log-purge-type=# | Specifies how Aria transactional log will be purged. Possible values of name are "immediate ", "external " and "at_flush " | immediate |
--aria-max-sort-file-size=# | Don't use the fast sort index method to created index if the temporary file would get bigger than this. | 9223372036853727232 |
--aria-page-checksum | Maintain page checksums (can be overridden per table withPAGE_CHECKSUM clause inCREATE TABLE ) | TRUE |
--aria-pagecache-age-threshold=# | This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in the page cache. | 300 |
--aria-pagecache-buffer-size=# | The size of the buffer used for index blocks for Aria tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford. | 134217720 (= 128M) |
| The minimum percentage of warm blocks in key cache | 100 |
--aria-recover[=#] | Specifies how corrupted tables should be automatically repaired. Possible values are "NORMAL " (the default), "BACKUP ", "FORCE ", "QUICK ", or "OFF " which is like not using the option. | NORMAL |
--aria-repair-threads=# | Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair. | 1 |
--aria-sort-buffer-size=# | The buffer that is allocated when sorting the index when doing aREPAIR or when creating indexes with CREATE INDEX orALTER TABLE . | 134217728 |
--aria-stats-method=# | Specifies how Aria index statistics collection code should treatNULL s. Possible values are "nulls_unequal ", "nulls_equal ", and "nulls_ignored ". | nulls_unequal |
--aria-sync-log-dir=# | Controls syncing directory after log file growth and new file creation. Possible values are "never ", "newfile " and "always "). | NEWFILE |
In normal operations, the only variables you have to consider are:
aria-pagecache-buffer-size
- This is where all data and index are cached. The bigger this is, the faster Aria will work.
aria-block-size
- The default value 8192, should be ok for most cases. The only with a higher value is that it takes long to find a packed key in the block as one has to search roughly 8192/2 to find each key. We plan to fix this by adding a dictionary at the end of the page to be able to do a binary search within the block before starting a scan. Until this is done and key lookups takes too long time even if you are not hitting disk, then you should consider making this smaller.
- Possible values to try are
2048
,4096
or8192
- Note that you can't change this without dumping, deleting old tables and deleting all log files and then restoring your Aria tables. (This is the only option that requires a dump and load)
aria-log-purge-type
- Set this to "
at_flush
" if you want to keep a copy of the transaction logs (good as an extra backup). The logs will stay around until you executeFLUSH LOGS
- Set this to "
o. trigger
o. id 规则
o. 异动数据建立的索引
o. 数据库的优化