---
title: "Indexing code at scale with Glean"
description: "Glean is Meta's open-source code indexing system that stores arbitrary language-specific facts about source code in RocksDB and exposes them through Angle, a declarative logic-based query language that can derive language-neutral views, much like SQL views."
url: "https://swe.quest/articles/indexing-code-at-scale-with-glean-139998a2186265ba"
canonical: "https://engineering.fb.com/2024/12/19/developer-tools/glean-open-source-code-indexing/"
source: "Meta Engineering"
published: "2024-12-19"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 11
tags: ["developer-tools","static-analysis","search","code-review","open-source"]
---

# Indexing code at scale with Glean

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2024-12-19, 11 min read, Deep dive. Original: [https://engineering.fb.com/2024/12/19/developer-tools/glean-open-source-code-indexing/](https://engineering.fb.com/2024/12/19/developer-tools/glean-open-source-code-indexing/)

## Summary

Glean is Meta's open-source code indexing system that stores arbitrary language-specific facts about source code in RocksDB and exposes them through Angle, a declarative logic-based query language that can derive language-neutral views, much like SQL views. Incremental indexing stacks immutable databases so each layer can add or hide facts, which brings indexing cost down to O(fanout) rather than O(repository) and lets the index serve multiple revisions without full copies. At Meta, Glean, together with the Glass symbol server, powers cross-language code navigation and C++ IDE acceleration alongside clangd. It also drives generated documentation, stable symbol IDs and diff sketches for code review, static analysis and commit search, with simple queries returning in about a millisecond.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Code review](https://swe.quest/tags/code-review.md) (Engineering practices)
- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)

## Prerequisites

- code navigation and LSP basics
- Datalog-style or SQL queries ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- monorepo development ([easy posts on Version control](https://swe.quest/tags/version-control.md?difficulty=easy))

## Keywords

Glean, Angle, Glass, RocksDB, LSIF, clangd, Phabricator

## Related posts

- [A brief history of code search at GitHub](https://swe.quest/articles/a-brief-history-of-code-search-at-github-ac152c8901d98c95.md): GitHub Engineering · 2021-12-15 · Medium · 13 min read · Search, Scaling, Developer tools
  GitHub's code search evolved from a public-only Solr index plus \`git grep\` for private repos, to a decade-long Elasticsearch deployment that grew to 162 nodes, 1.25PB of storage and over 53 billion indexed files.
- [The technology behind GitHub’s new code search](https://swe.quest/articles/the-technology-behind-github-s-new-code-search-7c9e939ab132b5db.md): GitHub Engineering · 2023-02-06 · Medium · 13 min read · Search, Rust, System design, Scaling, Data structures
  GitHub built Blackbird, a Rust code search engine, because general text search engines handled punctuation, regex, and GitHub's scale poorly, and brute-force grep would yield about 0.01 QPS.
- [Beyond API Compatibility: Building a Tool to Measure the Blast Radius of Library Changes](https://swe.quest/articles/beyond-api-compatibility-building-a-tool-to-measure-the-blast-radius-of-library-dd79bf180fb0310a.md): Netflix TechBlog · 2026-10-23 · Medium · 9 min read · API design, Static analysis, Java & JVM, Developer tools, AI agents
  Netflix's Quasar indexes symbol definitions and references across its repositories using SCIP, so library producers can see which consumers use the exact API symbols a change removes or modifies.
- [Building a code search engine with Turso](https://swe.quest/articles/building-a-code-search-engine-with-turso-6a98c3f86064a46b.md): Turso · 2026-02-26 · Medium · 6 min read · Vector search, Search, SQLite, AI agents, RAG & retrieval
  Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search.
- [Fast regex search: indexing text for agent tools · Cursor](https://swe.quest/articles/fast-regex-search-indexing-text-for-agent-tools-cursor-45908cf7bb0688f8.md): Cursor · 2026-03-23 · Medium · 20 min read · Search, Data structures, Algorithms, AI agents, Developer tools
  Agents lean heavily on regex search, and ripgrep's full scan can take over 15 seconds in large monorepos, so Cursor builds local indexes specifically to accelerate regex queries.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
