India has around 19100 pin codes. For an application, I want to calculate and store the distance between any two pin codes (this is not the challenge, will use google maps API to find it). On calculating this is around 182 million records (used sum of n numbers formula).
How can I store this data in such a way that it is easily retrieved and optimally stored?
One option I can think of is storing it as a table with aroun 8500 columns and 8500 rows, but that seems wrong to me. Is there a better way or library I can use?
I use python and postgresql.