LogoLogo
BlogDiscordGitHubDoltgres
  • Introduction
    • What is Doltgres?
    • Installation
    • Getting Started
  • Concepts
    • Git
      • Commits
      • Log
      • Diff
      • Branch
      • Merge
      • Conflicts
      • Remotes
      • Working Set
    • SQL
      • Databases
      • Schema
      • Tables
      • Primary Keys
      • Types
      • Indexes
      • Views
      • Constraints
      • Triggers
      • Functions
      • Procedures
      • Users/Grants
      • Transactions
      • System Variables
    • RDBMS
      • Server
      • Backups
      • Replication
  • Guides
    • Cheat Sheet
    • Replication from Postgres
  • Reference
    • Running the Server
      • Configuration
      • Access Management
      • Branch Permissions
      • Backups
      • Garbage Collection
      • Metrics
      • Replication
      • Troubleshooting
    • Version Control Features
      • Using Branches
      • Merges
      • Querying History
      • Using Remotes
      • Functions
      • System Tables
      • System Variables
    • SQL Language Support
      • Supported Functions and Operators
      • Supported Types
      • Supported SQL Commands
      • System Catalog Schema
    • Supported Clients
      • Programmatic
    • Benchmarks
      • Correctness
      • Latency
Powered by GitBook
On this page
  • What is a Database?
  • How to use Databases
  • Difference between Postgres Databases and Doltgres Databases
  • Interaction with Doltgres Version Control
  1. Concepts
  2. SQL

Databases

PreviousSQLNextSchema

Last updated 11 months ago

What is a Database?

A database is a container for a set of schema: , , , , etc. In relational databases, queries within a database are optimized, while queries across multiple databases are not.

A relational database management system or allows you to access multiple databases from a single running . Confusingly, "database" is also shorthand for RDBMS. Phrases like "Connect to this database" or "We run our database on AWS" refer to RDBMS, not the SQL concept of a schema container.

How to use Databases

Databases logically divide up your schema. Permissions can be applied to databases as a logical entity.

When you connect a client to a running server, you can see the databases being served using the \l command in the psql shell. To use a specific database, you issue a \c <database> statement. You can also specify the database in the connection string to connect to a particular database.

Difference between Postgres Databases and Doltgres Databases

In Doltgres, databases act like they do in Postgres.

Interaction with Doltgres Version Control

In Doltgres, each database has its own commit graph. So, Doltgres version control is limited to a single database. You cannot commit changes across multiple databases in a single commit. You cannot share a log across multiple databases. Branches cannot be made across databases.

Doltgres databases are the unit of sharing. Clone, push, pull, and fetch act on individual databases. Thus, to create a copy of multiple databases, you must clone from multiple remotes.

The only SQL statement not versioned in Doltgres is DROP DATABASE. This statement deletes the Doltgres database on disk, removing the database and all of its history. DROP DATABASE works this way for SQL tool compatibility as it is common for import tools to issue a drop database to clear all database state before an import. Doltgres implements like in Git so you can maintain an offline copy for backup using clone, fetch, push, and pull. Maintaining a remote copy allows you to restore in the case of an errant DROP DATABASE query.

tables
views
triggers
procedures
RDBMS
server
remotes