CREATE TABLE ItaiTable ( ItaiID INT4, Name VARCHAR(32) );
SELECT * FROM pgstattuple('itaitable’);
INSERT INTO ItaiTable (ItaiID, Name) VALUES (1, 'Itai’);
INSERT INTO ItaiTable (ItaiID, Name) VALUES (2, 'Yossi’);
SELECT relname, n_live_tup, n_dead_tup,
n_tup_ins, n_tup_upd, n_tup_del, vacuum_count
FROM pg_stat_user_tables WHERE relname = 'itaitable’;
UPDATE ItaiTable SET Name = 'Anat' WHERE ItaiID = 1;
UPDATE ItaiTable SET Name = 'Vitaly' WHERE ItaiID = 1;
DELETE FROM ItaiTable WHERE ItaiID = 1;
SELECT * FROM ItaiTable;
VACUUM ItaiTable;
SELECT * FROM heap_page_items(get_raw_page('itaitable', 0));
VACUUM FULL ItaiTable;
-- FULL = allocate the unused space back to the operating system
SELECT * FROM heap_page_items(get_raw_page('itaitable', 0));
No comments:
Post a Comment