Skip to content

Update maxminddb.zig to benefit from iterator caching#6

Merged
marselester merged 1 commit into
mainfrom
read-mmdb-cache
Feb 22, 2026
Merged

Update maxminddb.zig to benefit from iterator caching#6
marselester merged 1 commit into
mainfrom
read-mmdb-cache

Conversation

@marselester

Copy link
Copy Markdown
Owner

With iterator caching read_mmdb gets the following speed ups:

  • x2 on GeoLite2-City.mmdb (31.86s vs 15.6s)
  • x2.5 on GeoLite2-Country.mmdb (3.67s vs 1.46s)
-- before
SELECT count(*) FROM read_mmdb('./GeoLite2-City.mmdb');
100% ▕██████████████████████████████████████▏ (00:00:31.86 elapsed)     
┌────────────────┐
│  count_star()  │
│     int64      │
├────────────────┤
│    5502351     │
│ (5.50 million) │
└────────────────┘

-- after
SELECT count(*) FROM read_mmdb('./GeoLite2-City.mmdb');
100% ▕██████████████████████████████████████▏ (00:00:15.60 elapsed)     
┌────────────────┐
│  count_star()  │
│     int64      │
├────────────────┤
│    5502351     │
│ (5.50 million) │
└────────────────┘

-- before
.timer on
SELECT count(*) FROM read_mmdb('./GeoLite2-Country.mmdb');
100% ▕██████████████████████████████████████▏ (00:00:03.67 elapsed)     
┌──────────────┐
│ count_star() │
│    int64     │
├──────────────┤
│    993144    │
└──────────────┘
Run Time (s): real 3.673 user 3.594866 sys 0.055379

-- after
.timer on
SELECT count(*) FROM read_mmdb('./GeoLite2-Country.mmdb');
┌──────────────┐
│ count_star() │
│    int64     │
├──────────────┤
│    993144    │
└──────────────┘
Run Time (s): real 1.460 user 1.441185 sys 0.018690

@marselester
marselester merged commit ea5e6c1 into main Feb 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant