I have three columns with the following sizes in bytes (for a total of 8): 4 (int), 2 (small int), 2 (small int).
I'm creating a multicolumn (aka composite) index on these three columns (in the order specified above). I will be doing two types of select queries:
- Range look up based on the first 4-byte column. This first column will be monotonically increasing (timestamp).
- Key-ed look up where all three of these values are specified.
Question: Is there any benefit in Postgres to combining these three columns into one 8-byte bigint and dealing with the separation in the application layer?
I'm asking for a perspective on DB query and storage efficiency.