by driemekasten » Wed Jul 23, 2008 2:55 am
I enabled statement-logging in postgres and got the following. Please consider that my username to connect to the postgres-db is "poker". Change it to your needs (some of the ALTER TABLE statements):
Cluster:
LOG: statement: BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
LOG: statement: LOCK TABLE "holdem_hand_player_combinations", "holdem_hand_player_detail", "holdem_hand_player_statistics", "holdem_hand_summary", "holdem_table_session_summary", "player" IN ACCESS EXCLUSIVE MODE;
LOG: statement: CREATE TABLE "new_holdem_hand_player_combinations" AS SELECT * FROM "holdem_hand_player_combinations" ORDER BY id_player DESC, id_hand DESC;
LOG: statement: DROP TABLE "holdem_hand_player_combinations";
LOG: statement: ALTER TABLE "new_holdem_hand_player_combinations" RENAME TO "holdem_hand_player_combinations";
LOG: statement: CREATE INDEX "hhpc:idx1-id_hand" ON "holdem_hand_player_combinations" USING btree (id_hand);
LOG: statement: CREATE INDEX "hhpc:idx2-id_player" ON "holdem_hand_player_combinations" USING btree (id_player);
LOG: statement: ALTER TABLE "holdem_hand_player_combinations" ADD CONSTRAINT holdem_hand_player_combinations_primary_key PRIMARY KEY (id_hand, id_player), OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "holdem_hand_player_combinations_primary_key" for table "holdem_hand_player_combinations"
LOG: statement: CREATE TABLE "new_holdem_hand_player_detail" AS SELECT * FROM "holdem_hand_player_detail" ORDER BY id_player DESC, id_hand DESC;
LOG: statement: DROP TABLE "holdem_hand_player_detail";
LOG: statement: ALTER TABLE "new_holdem_hand_player_detail" RENAME TO "holdem_hand_player_detail";
LOG: statement: CREATE INDEX "hhpd:idx1-id_hand" ON "holdem_hand_player_detail" USING btree (id_hand);
LOG: statement: CREATE INDEX "hhpd:idx2-id_player" ON "holdem_hand_player_detail" USING btree (id_player);
LOG: statement: ALTER TABLE "holdem_hand_player_detail" ADD CONSTRAINT holdem_hand_player_detail_primary_key PRIMARY KEY (id_player, id_hand),OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "holdem_hand_player_detail_primary_key" for table "holdem_hand_player_detail"
LOG: statement: CREATE TABLE "new_holdem_hand_player_statistics" AS SELECT * FROM "holdem_hand_player_statistics" ORDER BY id_player DESC, id_session DESC, id_hand DESC;
LOG: statement: DROP TABLE "holdem_hand_player_statistics";
LOG: statement: ALTER TABLE "new_holdem_hand_player_statistics" RENAME TO "holdem_hand_player_statistics";
LOG: statement: CREATE INDEX "hhps:idx1-id_hand" ON "holdem_hand_player_statistics" USING btree (id_hand);
LOG: statement: CREATE INDEX "hhps:idx2-id_player" ON "holdem_hand_player_statistics" USING btree (id_player);
LOG: statement: CREATE INDEX "hhps:idx3-id_limit" ON "holdem_hand_player_statistics" USING btree (id_limit);
LOG: statement: CREATE INDEX "hhps:idx4-date_played" ON "holdem_hand_player_statistics" USING btree (date_played);
LOG: statement: CREATE INDEX "hhps:idx5-id_session" ON "holdem_hand_player_statistics" USING btree (id_session);
LOG: statement: CREATE INDEX "hhps:idx6-position" ON "holdem_hand_player_statistics" USING btree ("position");
LOG: statement: ALTER TABLE "holdem_hand_player_statistics" ADD CONSTRAINT holdem_hand_player_statistics_primary_key PRIMARY KEY (id_player, id_hand), OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "holdem_hand_player_statistics_primary_key" for table "holdem_hand_player_statistics"
LOG: statement: CREATE TABLE "new_holdem_hand_summary" AS SELECT * FROM "holdem_hand_summary" ORDER BY id_site, id_limit, id_table, id_hand DESC;
LOG: statement: DROP TABLE "holdem_hand_summary";
LOG: statement: ALTER TABLE "new_holdem_hand_summary" RENAME TO "holdem_hand_summary";
LOG: statement: CREATE INDEX "hhs:idx1-date_played" ON "holdem_hand_summary" USING btree (date_played);
LOG: statement: CREATE INDEX "hhs:idx2-id_limit" ON "holdem_hand_summary" USING btree (id_limit);
LOG: statement: CREATE INDEX "hhs:idx3-hand_no" ON "holdem_hand_summary" USING btree (hand_no);
LOG: statement: ALTER TABLE "holdem_hand_summary" ADD CONSTRAINT holdem_hand_summary_primary_key PRIMARY KEY (id_hand), ADD CONSTRAINT "hhs-unique_hand_no" UNIQUE (id_site, hand_no), OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "holdem_hand_summary_primary_key" for table "holdem_hand_summary"
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "hhs-unique_hand_no" for table "holdem_hand_summary"
LOG: statement: CREATE TABLE "new_holdem_table_session_summary" AS SELECT * FROM "holdem_table_session_summary" ORDER BY id_player DESC, id_session DESC;
LOG: statement: DROP TABLE "holdem_table_session_summary";
LOG: statement: ALTER TABLE "new_holdem_table_session_summary" RENAME TO "holdem_table_session_summary";
LOG: statement: CREATE INDEX "htss:idx1-id_player" ON "holdem_table_session_summary" USING btree (id_player);
LOG: statement: CREATE INDEX "htss:idx2-id_table" ON "holdem_table_session_summary" USING btree (id_table);
LOG: statement: ALTER TABLE "holdem_table_session_summary" ADD CONSTRAINT holdem_table_session_summary_primary_key PRIMARY KEY (id_session), OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "holdem_table_session_summary_primary_key" for table "holdem_table_session_summary"
LOG: statement: CREATE TABLE "new_player" AS SELECT * FROM "player" ORDER BY id_site, id_player DESC;
LOG: statement: DROP TABLE "player";
LOG: statement: ALTER TABLE "new_player" RENAME TO "player";
LOG: statement: CREATE INDEX "idx1:player_name_search" ON "player" USING btree (player_name_search);
LOG: statement: ALTER TABLE "player" ADD CONSTRAINT player_primary_key PRIMARY KEY (id_player), OWNER TO "poker";
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "player_primary_key" for table "player"
LOG: statement: COMMIT;
Vacuum:
LOG: statement: VACUUM FULL;
LOG: statement: VACUUM holdem_table_session_summary;
Analyze:
LOG: statement: ANALYZE;