Data location
Learn how the location of data stored in D1 is determined, including where the leader is placed and how you optimize that location based on your needs.
By default, D1 will automatically create your database in a location close to where you issued the request to create a database. In most cases this allows D1 to choose the optimal location for your database on your behalf.
Location hint is an optional parameter you can provide to indicate your desired geographical location for your database.
You may want to explicitly provide a location hint in cases where the majority of your writes to a specific database come from a different location than where you are creating the database from. location hints can be useful when:
- Working in a distributed team.
- Creating databases specific to users in specific locations.
- Using continuous deployment (CD) or Infrastructure as Code (IaC) systems to programmatically create your databases.
Provide a location hint when creating a D1 database when:
- Using
wrangler d1
to create a database. - Creating a database via the Cloudflare dashboard ↗.
To provide a location hint when creating a new database, pass the --location
flag with a valid location hint:
To provide a location hint when creating a database via the dashboard:
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Workers & Pages > D1 ↗.
- Select Create database.
- Provide a database name and an optional Location.
- Select Create to create your database.
D1 supports the following location hints:
Hint | Hint description |
---|---|
wnam | Western North America |
enam | Eastern North America |
weur | Western Europe |
eeur | Eastern Europe |
apac | Asia-Pacific |
oc | Oceania |