Design, configure, deploy
Why Auto Increment Is A Terrible Idea
The role of a primary key is to provide a stable, indexable reference to an entity. You have two ways to construct your primary key: either as a semantic key, or as a technical key.
.. PostgreSQL supports UUIDs, through the type
uuid
.> select '697dffc9-8ba5-410c-b677-227475a73530'::uuid; uuid -------------------------------------- 697dffc9-8ba5-410c-b677-227475a73530 (1 row)
Sharding & IDs at Instagram
- Our application servers run Django with PostgreSQL as our back-end database. Our first question after deciding to shard out our data was whether PostgreSQL should remain our primary data-store, or whether we should switch to something else. We evaluated a few different NoSQL solutions, but ultimately decided that the solution that best suited our needs would be to shard our data across a set of PostgreSQL servers.
- IDs should ideally be 64 bits (for smaller indexes, and better storage in systems like Redis)
At The Heart Of A Giant: Postgres At TripAdvisor
- 2 core-site datacenters with Postgres infrastructure tested to be capable of handling well over 1,100,000 database queries per minute.
- Servers with 768GB of RAM so everything fits in memory.
- Multi terabyte databases where only 5% can fit in RAM.
- A sharded core site (not warehouse!) table with over 2,600,000,000 tuples
This talk will be a look at how Postgres can form the backbone of a site at the scale of 315 million unique visitors a month