Getting Started
Install and benchmark learned indexes in your PostgreSQL database
Installation
# Clone and build
git clone https://github.com/omendb/pg-learned
cd pg-learned
cargo pgrx install
# In PostgreSQL
CREATE EXTENSION omendb;
Available Functions
learned_index_benchmark()
Compare learned indexes vs B-trees
learned_index_version()
Get extension version info
learned_index_info()
Learn how learned indexes work
Example Benchmark Results
Typical results when testing the PostgreSQL extension on sequential data:
Example Output from learned_index_benchmark(50000):
Dataset: 50,000 sequential keys
Function: learned_index_benchmark(50000)
Performance Comparison:
Linear Index: 6,500,000 queries/sec (50,000 found)
RMI Index: 7,200,000 queries/sec (50,000 found)
BTreeMap: 2,700,000 queries/sec (50,000 found)
Linear Speedup: 2.4x
RMI Speedup: 2.7x
Results vary based on data distribution and hardware.
Sequential/time-series data shows best performance gains.
Test yourself: Install the extension and run SELECT learned_index_benchmark(10000) to see performance on your hardware and data.
Quick Start SQL
-- Get version info
SELECT learned_index_version();
-- Learn about the technology
SELECT learned_index_info();
-- Benchmark with 50,000 keys
SELECT learned_index_benchmark(50000);
Expected Results
Typical Performance
- • Linear Index: 2-3x faster
- • RMI Index: 2-4x faster
- • Range queries: up to 16x faster
Safety Features
- • Input validation (1-1M keys)
- • Error handling
- • No crashes or hangs
This extension is just the beginning. We're building a full database from the ground up.