Talk:Requests for comment/DataStore/LQT Archive 1

Current state
There is no generic persistent key-value store in MediaWiki. This results in creation of multiple tables even when underlying data doesn't need joins with other tables or lookups by various fields.

Examples of such tables that are never going to have more than 1 row:
 * site_stats (core)
 * geo_updates (Extension:GeoData)

Another example is external storage that can use a generic key-value store rather than implement a custom version of it. And once we have

Proposal
A few design points:
 * Key-value storage.
 * Generic, allowing numerous implementations with different backends, possibly including NoSQL in the future.
 * Ability to have more than one store, using different engines/servers.
 * Only simple, atomic operations.
 * Records are searchable by key prefix.
 * Keys shouldn't be mangled to allow prefix search and migration from one storage engine to another.
 * To facilitate migration, maximum key length should be enforced across all implementations.

Proposed implementation skeleton is at . It's not an actual, functional code but just a demo of how it could look.

Example usage:

Example new store definition: