The vacuum command is an extended function of SQLite. It imitates the same commands in PostgreSQL. If VACUUM is called with a table name or index name, the table or index will be sorted. In SQLite 1.0, the VACUUM command calls gdbm_reorganize () to
Vacuum commands exist in two forms, vacuum and vacuum full, and the difference between them is shown in the following table:
No vacuum
VACUUM
VACUUM full
After deleting large amounts of data
Simply
Delete all data from the table:DELETE from [Name]When a large amount of data has been deleted in SQLite, the size of the database file remains the same. The reason: After deleting data from SQLite, unused disk space is added to an intrinsic "free
Vacuum full locks the table and is very inefficient. In practice, vacuum cannot be used to narrow down the pg_class, resulting in a long downtime.In fact, the simplest way to implement vacuum full is to copy a table again, create table B as select *
First, restore disk space:
In PostgreSQL, data rows that are deleted or updated using the Delete and UPDATE statements are not actually deleted, but only the state of the row is deleted or expired on the physical address of the old version of the
PostgreSQL tutorial (14): database maintenance, postgresql tutorial
I. Disk Space Restoration:
In PostgreSQL, the data rows deleted or updated using the delete and update statements are not actually deleted, the physical address of the old data row
I. Disk Space Restoration:
In PostgreSQL, the data rows deleted or updated using the delete and update statements are not actually deleted, the physical address of the old data row sets the row status to deleted or expired. Therefore, when data in a
I. restore disk space
In PostgreSQL, the data rows deleted or updated using the delete and update statements are not actually deleted, the physical address of the old data row sets the row status to deleted or expired. Therefore, when data in a
0, password file:
Before giving other PostgreSQL client commands, we need to introduce the password file in PostgreSQL. The file is explained here in advance because we are applying the file in a lot of the following sample code to ensure that our
Sqlce is too slow to compare the execution speed with SQLite.
Therefore, in the next version of the project, replace sqlce with SQLite.
After all, SQLite is not used.
The results are indeed good. Two points are satisfactory.
First, the execution
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.