
What are Production Databases?
Production databases are the live, operational databases that serve real users and their data. They differ significantly from development databases in several key ways:Production vs Development Databases
| Aspect | Development Database | Production Database |
|---|---|---|
| Purpose | Experimentation and feature development | Serving real users and storing business data |
| Data | Test data, dummy records, small datasets | Real user data, business-critical information |
| Performance | Optimized for development speed | Optimized for reliability and user experience |
| Changes | Frequent schema changes, rapid iteration | Careful, planned changes via data migrations and rollback strategies |
| Downtime | Acceptable during development | Must be minimized or eliminated |
| Backup | Optional for testing | Critical for business continuity |
Agent is not able to modify the production database, this restriction is in place so that your production database stays safe.Agent can make edits to your development database. At the time of publishing, any changes you’ve made with the agent to the structure of your development database (i.e. adding and deleting columns / tables) will be applied over to your production database.You are manually able to edit your production data at anytime by going to database pane > production database > My data and toggling Edit
Database Technology and Infrastructure
Production databases in Replit are built on the same robust foundation as our standard SQL Database offering. They use PostgreSQL 16 hosted on Neon, providing enterprise-grade reliability and performance.Relationship to Replit SQL Database
Production databases share the same core technology stack as Replit’s SQL Database:- PostgreSQL 16: Industry-standard relational database with advanced features
- Neon Infrastructure: Serverless database platform that provides automatic scaling and cost optimization
- Built-in Tools: Access to SQL runner, Drizzle Studio, and visual data management tools
- Environment Variables: Secure connection management through automatically generated credentials
For detailed information about database features, connection setup, and
technical specifications, see the SQL
Database documentation.
Making safe changes to your production database
When you publish updates to your Replit App that include database changes, you may encounter scenarios where careful planning is essential to avoid downtime or data loss.Non-Backward Compatible Changes
Some database changes can break compatibility with your existing application code. These changes require special handling to ensure smooth deployments.You may notice a brief downtime for your published app during publishing. This downtime occurs because database changes sometimes require stopping your app temporarily to prevent conflicts and ensure safe updates. Stopping the app during these updates helps protect your data from loss or corruption while the changes are applied.
Common Non-Backward Compatible Changes
The following types of changes typically require careful publishing strategies:- Removing database columns that your application code still references
- Changing column data types in ways that existing code cannot handle
- Adding required fields without default values to existing tables
- Renaming tables or columns that break existing queries
- Modifying constraints that could reject existing application logic
Deployment Previews
Before publishing database changes to production, Replit provides tools to test your changes safely in a preview environment. A deployment preview is a temporary, isolated copy of your production environment where you can test database changes and application updates before they affect real users. This preview environment mirrors your production setup but operates independently. It can help you catch potential issues early and ensure your changes work correctly before going live. Testing your deployment in the preview environment is crucial for identifying issues before they impact your users. Follow these steps to ensure your database changes work correctly: 1. Functional Testing- Verify that your app still works properly with the database changes applied
- Test all major user flows to ensure functionality remains intact
- Check that data displays correctly after the schema modifications
- Confirm that existing data has been properly migrated or transformed
- Verify that new fields contain expected values or appropriate defaults
- Test edge cases where data might not conform to new constraints
- Monitor query response times in the preview environment
- Check that new indexes are being used effectively
- Verify that the changes don’t introduce performance regressions
Point-in-time restore
For production databases, you can restore your database to a specific point in time using the point-in-time restore feature.
Billing and resource usage
Production databases are billed based on usage through Neon, a serverless database provider. Neon’s serverless capabilities include the following:- Zero infrastructure setup or maintenance
- Automatic scaling to handle your usage needs
- Compute time billing only when the database is active
How to access database usage
How to access database usage
To view your database compute time and storage usage for the current billing period, follow the steps below:From the Replit Database tool:
- Navigate to the
Replit Database tool in your workspace
- In the database dropdown menu, select Production
- Select the
Settings tab
- The Storage Used section shows the total storage used by your database for the current billing period.
- Select View account resource limits to open the Usage page
- Scroll to Resource usage section
- Expand the PostgresSQL Storage and PostgresSQL Compute rows for details on each Replit App
Troubleshooting Common Issues
Publishing Failures
If your publishing fails due to database issues:- Check the publishing logs for specific error messages about database connectivity or schema conflicts
- Verify your database connection credentials are correct and accessible from the published app environment
- Review recent schema changes for potential conflicts with existing application code
- Test your changes in a preview environment before attempting to republish
Removing a production database
If you no longer need a database for your Replit App, you can remove it and all its data.How to remove a database
How to remove a database
From the Replit Database tool:
- Select the
Settings tab
- Select Remove database and confirm by selecting Yes, Remove database
Next Steps
To learn more about database management on Replit:- SQL Database: Learn about Replit’s managed PostgreSQL database service
- Key-Value Store: Explore Replit’s simple key-value database option
- Deployments: Understand how deployments work with database changes
- Object Storage: Learn about storing files and assets in the cloud