VIOLENCIA DE GÉNERO
4. DEL AMOR ROMÁNTICO A LA VIOLENCIA DE GÉNERO
4.4 AMOR ROMÁNTICO Y VIOLENCIA DE GÉNERO EN CREPÚSCULO
Synopsis
The default Aster Database behavior requires that you pass a tablename argument:
VACUUM [ FULL ] tablename [ CASCADE ]
When you run ANALYZE during a vacuum, you can also pass one or more columnname arguments, if you wish to update statistics for only that column or columns:
VACUUM [ FULL ] ANALYZE [ tablename [ ( columnname [, ...] ) ] ] [ CASCADE ]
Optional Aster Database behavior allows you to omit the tablename to VACUUM the whole database. This behavior is not allowed in a default Aster Database installation; contact Aster Data support if you wish to enable it. See “Optional: Running VACUUM on a database” on page V-94. With this feature enabled, the following synopsis applies in addition to the two above:
VACUUM [ FULL ] [ ANALYZE ]
Description
VACUUM reclaims storage occupied by deleted rows. In normal Aster Database operation, rows that are deleted or made obsolete by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore it is necessary to do VACUUM periodically, especially on frequently-updated tables.
If your table has child tables created through inheritance, don’t forget to include the CASCADE
option. If the table is a logically partitioned table, VACUUM automatically acts on the whole hierarchy.
VACUUM ANALYZE performs a VACUUM and then an ANALYZE on the specified table. This updates the table’s statistics for proper query planning. See ANALYZE for details.
The differences between VACUUM and VACUUM FULL:
• VACUUM simply reclaims space and makes it available for re-use. This form of the command does not take an exclusive lock on the table, so queries on the table can continue while
VACUUM is ongoing (although you should expect them to run more slowly). Note that the reclaimed space is not returned to the system/user. Rather, obsolete rows are marked as reusable, and the space will be reclaimed by a future INSERT.
• VACUUM FULL takes an exclusive lock on the table so that it can move rows across blocks to compact the table to the minimum number of disk blocks. Running VACUUM FULL takes much longer than running VACUUM. While a table is being processed by VACUUM FULL, any new queries on that table will wait for the vacuum processing to finish. In contrast to plain
Aster Data proprietary and confidential VACUUM
Parameters
Outputs
No output.
Notes
Usage Recommendations Observe these recommendations when deciding whether to
VACUUM a table:
• VACUUM generates a large amount of I/O traffic, which can slow other queries.
• After adding or deleting a large number of rows, it’s a good idea to issue a VACUUM ANALYZE command for the affected table. This updates the system catalogs so that query planner can plan more efficient queries.
• When possible, use VACUUMrather thanVACUUM FULL.
• Do not run VACUUM while bulk loading is ongoing.
• Do not run VACUUM FULL (especially on an entire database) on a production database on which users are actively running queries, because VACUUM FULL is a very expensive operation.
• If you do need to run VACUUM on an active production database, then we recommend you run it at a per-table level. If a particular table has a large number of dead rows, then you can get faster results by using CREATE TABLE AS SELECT to replace the table, rather than vacuuming the table. That is, instead of running this:
VACUUM bloated_table;
...run this:
BEGIN;
CREATE TABLE new_table AS SELECT * FROM bloated_table; DROP bloated_table;
ALTER TABLE RENAME new_table TO bloated_table; END;
Checking whether a VACUUM is needed To find out whether a table would benefit from a VACUUM operation, you can check its dead row percentages (as well as its uncompressed table size) using the ncluster_storagestat function. Run ACT as an administrator and check it like this:
SELECT * FROM ncluster_storagestat('sometablename');
This reveals the number of dead rows, live rows, size of dead rows, size of live rows, etc., so you can decide whether to run VACUUM FULL.
FULL Selects "full" vacuum, which may reclaim more space, but takes much longer and exclusively locks the table.
ANALYZE Updates statistics used by the planner to determine the most efficient way to execute a query. tablename The name of a specific table to vacuum.
columnname The name of a column to ANALYZE. If omitted, all columns are ANALYZEd.
WITH Aster Data proprietary and confidential
Cancelling a VACUUM As administrator, you can cancel an issued VACUUM or VACUUM FULL operation using the AMC interface. Use the Cancel Statement button in the Activity tab of the AMC.
Optional: Running VACUUM on a database The comands VACUUM tablename and
VACUUM FULL tablename are standard Aster Database commands that run on a single table, but VACUUM (without a table name) and VACUUM FULL (without a table name) are optional Aster Database commands that VACUUM the entire database. Warning: Running VACUUM FULL on a database, locks one table at a time while the VACUUM runs on that table, and may take a long time to run.
The ability to run VACUUM on the entire database is disabled by default in Aster Database. If you wish to run VACUUM on a database, please contact Aster Data support to have this feature enabled.
Compatibility
There is no VACUUM statement in the SQL standard.
See Also
“ANALYZE” on page V-17, and “REINDEX” on page V-70, “TRUNCATE” on page V-88, and
“Handling Dead Space in Aster Database” on page II-22.