This is going to depend on a few things:
- How much RAM is available to your Redis server
- How many objects you want to store
- The size of the serialized objects and their fields
Storing the serialized object will take up much more space because you have all the extra language-specific information stored along with the raw data. If you're short on RAM or have to store a large amount of objects, it's probably going to be best to store all this data in a hash. Since you have 1 million rows, you'll probably save quite a bit of space by using hashes.
I recently ran into a very similar issue. At first I tried storing the serialized objects in the Redis DB, but I had to store over 5 million objects and each object contained a lot of excess data that I didn't need to store in the DB. This resulted in a bloated DB size and wasted a good amount of RAM.
Your requirements will probably differ from mine quite a bit, so it's best to benchmark it yourself. Try serializing an object and see how big the result is. Compare that to the size of the sum of the keys and compare the size difference between the two. If the serialized object isn't much bigger, it might be best to just serialize. It's also good to keep in mind that unserializing isn't a negligible operation.