Database capabilities
The database system supports:- Fast position search across millions of games using memory-mapped binary indexes
- Game filtering by player, tournament, date, ELO rating, and result
- Player statistics with opening repertoire analysis and rating trends
- Tournament data with event and site information
- Full-text search for finding games by player name or tournament
Supported formats
En Croissant works with industry-standard chess database formats:PGN (Portable Game Notation)
The application can import PGN files in various encodings:- Standard
.pgnfiles - Compressed
.pgn.zst(Zstandard compression) - Compressed
.pgn.bz2(Bzip2 compression)
Database files
En Croissant uses.db3 (SQLite) database files that include:
- Games table with move data stored as binary-encoded movetext
- Players table with name normalization and ELO tracking
- Events and Sites tables for tournament organization
- Custom indexes for fast position and game lookup
- Binary search index (
.idxfiles) for position queries
Creating a database
You can create databases in multiple ways:Import from PGN file
Click “Add Database” and select the “Local” tab, then choose a PGN file from your computer. The application will convert it to an optimized database format.
Download from web
Browse curated databases in the “Web” tab and click “Install” to download pre-built databases with millions of games.
Import from online platforms
Import your games directly from Lichess.org or Chess.com using OAuth authentication (see Importing games).
Database operations
Viewing database information
Access database details from the Databases page:Managing indexes
Indexes dramatically improve search performance but increase file size:Creating indexes on a large database can take several minutes but only needs to be done once.
- Enables fast filtering by player, date, rating, and result
- Required for optimal performance on databases with >10,000 games
- Automatically created during PGN import
- Reduces database file size by ~30-40%
- Useful for archival or when disk space is limited
- Can be recreated at any time
Position search indexing
For position-based queries, En Croissant generates a binary search index (.idx file):
- Automatic generation when first searching a database
- Memory-mapped access for instant loading of millions of games
- Parallel search using all CPU cores for maximum speed
- Cached results to avoid redundant searches
- Material counts (for quick position reachability checks)
- Pawn structure data (for exact position matching)
- Move sequences in binary format
- Player ratings and game results
Editing database metadata
Update database title and description through the database settings menu. This information is stored in the database’s internalInfo table.
Deleting databases
Deleting a database removes both the.db3 file and associated .idx search index file. This operation cannot be undone.
Database maintenance
Removing duplicate games
En Croissant can detect and remove duplicate games based on:- Same players (White and Black)
- Same event and site
- Same date and time
- Identical move sequence
Removing empty games
Games with no moves (ply count = 0) can be filtered out to reduce database size and improve data quality.Database optimization
After removing duplicates or empty games, the database automatically:- Deletes orphaned player records (players with no games)
- Deletes orphaned event and site records
- Updates game counts in the Info table
- Maintains referential integrity
Performance characteristics
Small databases
< 100,000 games
- Instant loading and search
- Indexes optional
- Suitable for personal game collections
Large databases
1M+ games
- Memory-mapped index required
- Parallel position search
- Optimized for master game databases
Technical implementation
En Croissant’s database system uses:- SQLite with connection pooling (up to 16 concurrent connections)
- Diesel ORM for type-safe database queries
- Custom binary encoding for moves, reducing storage by ~60% vs. text
- Rayon for parallel processing of large imports and searches
- Memory-mapped I/O for instant access to multi-GB search indexes
src-tauri/src/db/encoding.rs: