-
Notifications
You must be signed in to change notification settings - Fork 18
Database types
Chess games can be permanently stored in different ways. This section describes the database types available in scid.
PGN (Portable Game Notation) is the most common way to encode games into a single file. As implied by its name, its best feature is its portability. Because it is a simple, standardized, text-based format, it can be easily read and written by a wide range of chess software. Even a simple text editor can be used.
The drawback is that it is not a very efficient format for storing large numbers of games. A database of thousands or even millions of games can take up a lot of space when stored in PGN format. Furthermore parsing a text file is slow and it is not possible to update a game without also rewriting all the subsequent ones.
In scid, to improve the search speed, all the games contained in a PGN file are loaded into memory and particular care was dedicated to:
- correctness: when a PGN file is open, all the games are recreated. If there are anomalies, or illegal moves, they are reported to the user.
- portability: many chess software add or remove newlines in the user's move comments. In scid the comments entered by the users are unaltered.
- reliability: rewriting many games is not only slow, but it also may lose all those games if a fault happens. To prevent that, a new version is instead appended to the end of the file, and all the other games, including the previous version, are left untouched. It's all transparent to the user, who only sees the latest version of a game. It is possible to compact the database to recover space or before using it with other programs.
This is the highest performant database available. Both in terms of speed and minimum compressed size. Technical description.