dba_optimize

(PHP 4, PHP 5, PHP 7, PHP 8)

dba_optimize优化数据库

说明

dba_optimize(Dba\Connection $dba): bool

dba_optimize() 优化底层数据库。

参数

dba

一个由 dba_open()dba_popen() 返回的 Dba\Connection 实例。

返回值

成功时返回 true, 或者在失败时返回 false

更新日志

版本 说明
8.4.0 dba 参数现在接受 Dba\Connection 实例, 之前接受有效的 dba resource

参见

添加备注

用户贡献的备注 2 notes

up
4
doppelbauer at gmail dot com
18 years ago
The difference between "dba_optimize" and "dba_sync":

Use "dba_optimize" to optimize a database, which usually consists of eliminating gaps between records created by deletes.

The "dba_sync" function will synchronize the view of the database in memory and its image on the disk. As you insert records, they may be cached in memory by the underlying engine. Other processes reading from the database will not see these new records until synchronization.
up
0
samuele at removethisnorsam dot org
21 years ago
Note that the internal structure of each DB that needs to access etherogeneous data in a *fast* way it is not necessarily space-optimized. So, if you add-remove-substitute keys with data having different content length, the db continues to grow, wasting space. So, it is necessary, sometimes, to re-pack the db in order to remove unused data from the db itself. But it is important to remind that, even if the file grows, the data remain optimized and - obviously - the access continues to be fast. Further information are available at dba_replace() user-contributed notes.
To Top