Database Instance
Database Instance
Definition
A database instance is the actual data stored in the database at a specific point in time — the collection of all current relations (one relation instance per relation schema) that together conform to the database schema. If the schema is the blueprint, the instance is the live snapshot of real data right now.
Example
At 10:00 AM, the database instance might have Students with 4 tuples, Courses with 12 tuples, and Enrollments with 30 tuples. At 10:05 AM, after a new admission, Students gains a 5th tuple — this is now a new database instance, even though the database schema has not changed at all.
How this differs from Database Schema / Relation
- Database Schema = structure, (mostly) time-invariant; Database Instance = the full set of data across ALL relations at one moment, changing on every transaction.
- A Relation is the data for ONE relation schema; a Database Instance is the union of the current relations for EVERY relation schema in the database — i.e., "the whole database's state" versus "one table's state."
Edge Cases
- Every valid database instance must satisfy all integrity constraints declared in the schema (keys, foreign keys, domain constraints) — an instance that violates a foreign key is not a legal instance.
- Backup snapshots and "time-travel" queries are, literally, different database instances captured at different times under the same schema.
- Concurrent transactions can each observe or produce different intermediate instances (depending on the isolation level) even though exactly one schema governs all of them.
Key Takeaways / Q&A
Q: If I run `DROP TABLE Enrollments`, am I changing the instance or the schema? A: The schema — you are removing a relation schema entirely, which also destroys its instance data; that is a structural change, not merely a data change.
Q: Can two different databases share the same schema but have different instances? A: Yes — a "staging" and a "production" database can be created from an identical schema yet hold completely different data (different instances) at any given time.