Skip to main content
added 66 characters in body
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117
CREATE TABLE blah(
    user_id MEDIUMINT UNSIGNED NOT NULL,  -- 3 bytes
    date DATE NOT NULL,  -- 3 bytes
    prayers SET('1','2','3','4','5') NOT NULL,  -- 1 byte
    PRIMARY KEY(user_id, date)
) ENGINE=InnoDB;

will occupy about 30GB (including overhead).

You may need other indexes, depending on what the queries are.

CREATE TABLE blah(
    user_id MEDIUMINT UNSIGNED NOT NULL,  -- 3 bytes
    date DATE NOT NULL,  -- 3 bytes
    prayers SET('1','2','3','4','5') NOT NULL,  -- 1 byte
    PRIMARY KEY(user_id, date)
) ENGINE=InnoDB;

will occupy about 30GB (including overhead).

CREATE TABLE blah(
    user_id MEDIUMINT UNSIGNED NOT NULL,  -- 3 bytes
    date DATE NOT NULL,  -- 3 bytes
    prayers SET('1','2','3','4','5') NOT NULL,  -- 1 byte
    PRIMARY KEY(user_id, date)
) ENGINE=InnoDB;

will occupy about 30GB (including overhead).

You may need other indexes, depending on what the queries are.

Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

CREATE TABLE blah(
    user_id MEDIUMINT UNSIGNED NOT NULL,  -- 3 bytes
    date DATE NOT NULL,  -- 3 bytes
    prayers SET('1','2','3','4','5') NOT NULL,  -- 1 byte
    PRIMARY KEY(user_id, date)
) ENGINE=InnoDB;

will occupy about 30GB (including overhead).