PLEX
Official code of "PLEX: Towards Practical Learned Indexing", aka TrieSpline (AIDB @VLDB'21)
Install / Use
/learn @stoianmihail/PLEXREADME
PLEX: Towards Practical Learned Indexing
PLEX only has a single hyperparameter ϵ (maximum prediction error) and offers a better trade-off between build and lookup time than state-of-the-art approaches.
Build
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
./example
Examples
Using ts::Builder to index sorted data:
// Create random keys.
std::vector<uint64_t> keys(1e6);
generate(keys.begin(), keys.end(), rand);
keys.push_back(424242);
std::sort(keys.begin(), keys.end());
// Build PLEX
uint64_t min = keys.front();
uint64_t max = keys.back();
ts::Builder tsb(min, max, keys.size());
for (const auto& key : keys) tsb.AddKey(key);
auto ts = tsb.Finalize();
// Search using PLEX
ts::SearchBound bound = ts.GetSearchBound(424242);
std::cout << "The search key is in the range: ["
<< bound.begin << ", " << bound.end << ")" << std::endl;
auto start = std::begin(keys) + bound.begin, last = std::begin(keys) + bound.end;
auto pos = std::lower_bound(start, last, 424242) - begin(keys);
assert(keys[pos] == 424242);
std::cout << "The key is at position: " << pos << std::endl;
Cite
Please cite our AIDB@VLDB 2021 paper if you use this code in your own work.
Related Skills
feishu-drive
347.6k|
things-mac
347.6kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
347.6kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
codebase-memory-mcp
1.2kHigh-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 66 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.
