I’d like to recommend an interesting post, “Sharding & IDs at Instagram”, about sharding using Postgres.