BL-RO
BL-RO

Reputation: 11

PostgreSQL database with ~10,000 boolean states per row

I'm at a bit of a loss as to how design this particular database. It has the following features:

The obvious design is to have a lookup table between the users and the states, but I'm concerned this will not be fast enough, when looking up states per user, with an expected 5 billion+ rows in the lookup table.

Any advice is appreciated.

Upvotes: 1

Views: 48

Answers (1)

DarkMukke
DarkMukke

Reputation: 2489

I would create a relation between 2 tables

--------------------------------------------------
| ID | username                                  |
--------------------------------------------------
| 1  | bl-ro                                     |
--------------------------------------------------
| 2  | darkmukke                                 |
--------------------------------------------------

and then a relation for the bools

--------------------------------------------------
| ID | fk_user | bool                            |
--------------------------------------------------
| 1  | 1       | true                            |
--------------------------------------------------
| 2  | 1       | false                           |
--------------------------------------------------

Upvotes: 1

Related Questions