I've been fortunate to design and build two secondary index systems from scratch. The first one was for the attempted rewrite of CouchDB on top of [[FoundationDB]] and the second was for the original [Tigris database](https://github.com/tigrisdata/tigris). Below is a list of resources on building secondary indexes in general and also using FoundationDB. ## My documentation and talks on secondary indexes Below are a list of code, documentation and talks I've on secondary indexes: ### Tigris 1. The [public facing RFC](https://github.com/tigrisdata/tigris/blob/main/docs/rfcs/001-secondary-indexes.md) for building secondary indexes for Tigris DB 2. The initial [index builder PR](https://github.com/tigrisdata/tigris/pull/829) and the [index reader PR](https://github.com/tigrisdata/tigris/pull/806) for secondary indexes 3. [A talk I did](https://www.youtube.com/watch?v=qD1h5CyzL0A) at the online FoundationDB meetup on how secondary indexes work in TigrisDB ### CouchDB 1. [RFC](https://github.com/apache/couchdb/blob/main/src/docs/rfcs/008-map-indexes.md) for building indexes for CouchDB on FDB 2. The [first PR](https://github.com/apache/couchdb/pull/2060) to add secondary indexes to CouchDB on FDB 3. A [talk I did](https://www.youtube.com/watch?v=QKzmNXrSq5w) about the above work at FoundationDB conference in 2019 ## Favourite resources for secondary indexes 1. CockroachDB has an [RFC](https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/20171020_inverted_indexes.md) on their gin index implementation 2. The [Azure DocumentDB paper](https://www.vldb.org/pvldb/vol8/p1668-shukla.pdf) on how they implemented json indexes is an excellent read 3. The [Firebase paper](https://research.google/pubs/pub52292/) has a good section on the tradeoffs they made around secondary indexes to handle high throughput. 4. [Mike Rhodes](https://dx13.co.uk/articles/2023/12/02/byo-index-pt1/) has very good series on building a JSON index. 5. [Ryan Worl](https://www.youtube.com/watch?v=QKzmNXrSq5w) did a good introduction talk at the FoundationDB conference on building indexes and change feeds using FoundationDB 6. [Phil Eaton](https://notes.eatonphil.com/zigrocks-sql.html) shows how to build a SQL database using zig and rocks db.