I have the next psql database:
CREATE TABLE "readings33" (
"uniqueid" BIGSERIAL PRIMARY KEY,
"uniqueid_sensor" INTEGER NOT NULL,
"timestamp" TIMESTAMP NOT NULL DEFAULT NULL,
"value" VARCHAR(15) NOT NULL,
CONSTRAINT "FK_readings_sensors" FOREIGN KEY ("uniqueid_sensor") REFERENCES "public"."sensors" ("uniqueid") ON UPDATE NO ACTION ON DELETE CASCADE
);
AFAIK the total size should be around:
"uniqueid" -> 8 bytes
"uniqueid_sensor" -> 4 bytes
"timestamp" -> 10 bytes
"value" VARCHAR(15) 8 bytes (because my value length for the test is a string with 8 bytes)
The sum of all is 8+4+10+8 = 30 bytes but when I write 100.000 rows to the DB this occupees 12.5 Mibs that is 125 bytes per row. I've done this text with 10.000 rows and the relation is about the same... Can anybody tell me why this increment is size??
Thanks in advance