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 Table?
  • How to use Tables
  • Difference between Postgres Table and Doltgres Table
  • Interaction with Dolt Version Control
  • Example
  1. Concepts
  2. SQL

Tables

PreviousSchemaNextPrimary Keys

Last updated 7 months ago

What is a Table?

Tables are the core unit of database . Tables are defined by a set of columns. Columns can be which act as a unique identifier for each row. Once a table schema is defined, rows containing data can be inserted into the table.

Table data is stored on disk. The way a database lays out it's table data on disk defines some of the performance characteristics of the database.

How to use Tables

Structure the data in your database into tables. Define relationships between tables using foreign key . Use CREATE statements to create tables and ALTER statements to change their schema.

Difference between Postgres Table and Doltgres Table

A Postgres and Dolt table function the same on the surface. CREATE and ALTER statements work the same on both.

Dolt and Postgres are , meaning row values are stored next to each other. However, Postgres stores data in a binary tree structure while Dolt stores table data on disk using a content-addressed binary tree called a . This setup makes Dolt while also providing history-independence and fast diff between versions. Fast diff powers Dolt's version control capabilities.

Interaction with Dolt Version Control

Dolt versions table schema and data. A table in Dolt is akin to a file in Git, it is the unit of change. Tables are the target of select dolt_add().

Example

doltgres=> \dt
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 public | t1   | table | postgres
(1 row)
schema
primary keys
constraints
row major
prolly tree
fairly comparable in query performance to Postgres