mirror of https://github.com/citusdata/citus.git
Add rudimentary ANALYZE support
parent
210c840d14
commit
bcfedac399
|
@ -377,11 +377,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
{
|
||||
VacuumStmt *vacuumStmt = (VacuumStmt *) parsetree;
|
||||
|
||||
/* must check fields to know whether actually a vacuum */
|
||||
if (vacuumStmt->options | VACOPT_VACUUM)
|
||||
{
|
||||
ProcessVacuumStmt(vacuumStmt, queryString);
|
||||
}
|
||||
ProcessVacuumStmt(vacuumStmt, queryString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -989,6 +985,13 @@ DeparseVacuumStmtPrefix(VacuumStmt *vacuumStmt)
|
|||
);
|
||||
const int vacuumFlags = vacuumStmt->options;
|
||||
|
||||
if (!(vacuumStmt->options & VACOPT_VACUUM))
|
||||
{
|
||||
appendStringInfoString(vacuumPrefix, "ANALYZE ");
|
||||
|
||||
return vacuumPrefix;
|
||||
}
|
||||
|
||||
appendStringInfoString(vacuumPrefix, "VACUUM ");
|
||||
|
||||
if (!(vacuumFlags & supportedFlags))
|
||||
|
|
|
@ -83,9 +83,9 @@ SELECT master_create_worker_shards('dustbunnies', 1, 2);
|
|||
|
||||
-- add some data to the distributed table
|
||||
\copy dustbunnies from stdin with csv
|
||||
-- delete all rows from the shard, then run VACUUM against the table on the master
|
||||
DELETE FROM dustbunnies;
|
||||
-- run VACUUM and ANALYZE against the table on the master
|
||||
VACUUM dustbunnies;
|
||||
ANALYZE dustbunnies;
|
||||
-- update statistics, then verify that the four dead rows are gone
|
||||
\c - - - :worker_1_port
|
||||
SELECT pg_sleep(.500);
|
||||
|
@ -100,3 +100,9 @@ SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);
|
|||
1
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_get_analyze_count('dustbunnies_990002'::regclass);
|
||||
pg_stat_get_analyze_count
|
||||
---------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
|
|
@ -56,11 +56,22 @@ SELECT master_create_worker_shards('dustbunnies', 1, 2);
|
|||
4,roger
|
||||
\.
|
||||
|
||||
-- delete all rows from the shard, then run VACUUM against the table on the master
|
||||
DELETE FROM dustbunnies;
|
||||
-- run VACUUM and ANALYZE against the table on the master
|
||||
VACUUM dustbunnies;
|
||||
ANALYZE dustbunnies;
|
||||
|
||||
-- update statistics, then verify that the four dead rows are gone
|
||||
\c - - - :worker_1_port
|
||||
SELECT pg_sleep(.500);
|
||||
SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);
|
||||
SELECT pg_stat_get_analyze_count('dustbunnies_990002'::regclass);
|
||||
|
||||
|
||||
-- try a mixed VACUUM ANALYZE
|
||||
\c - - - :master_port
|
||||
VACUUM (FULL, ANALYZE) dustbunnies;
|
||||
|
||||
-- update statistics, then verify that the four dead rows are gone
|
||||
\c - - - :worker_1_port
|
||||
SELECT pg_sleep(.500);
|
||||
SELECT * FROM pg_stat_all_tables WHERE relid = 'dustbunnies_990002'::regclass;
|
||||
|
|
Loading…
Reference in New Issue