Skip to content

Avoid copying into OwnedBytes when opening a fast field column Dictionary. - #55

Merged
stuhood merged 1 commit into
mainfrom
stuhood.avoid-owned-bytes-dictionary
Jul 14, 2025
Merged

Avoid copying into OwnedBytes when opening a fast field column Dictionary.#55
stuhood merged 1 commit into
mainfrom
stuhood.avoid-owned-bytes-dictionary

Conversation

@stuhood

@stuhood stuhood commented Jul 13, 2025

Copy link
Copy Markdown
Collaborator

When a fast fields string/bytes Dictionary is opened, we currently read the entire dictionary from FileSlice -> OwnedBytes... and then immediately wrap it back into a FileSlice.

Switching to Dictionary::open preserves the FileSlice, such that only the portions of the Dictionary which are actually accessed are read from disk/buffers.

@stuhood
stuhood force-pushed the stuhood.avoid-owned-bytes-dictionary branch from 73d0776 to 019de0d Compare July 13, 2025 23:16

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

This is a much smaller changeset than I had to do for the numeric fast fields!

@stuhood
stuhood merged commit 16740ad into main Jul 14, 2025
5 checks passed
@stuhood
stuhood deleted the stuhood.avoid-owned-bytes-dictionary branch July 14, 2025 13:59
stuhood added a commit to paradedb/paradedb that referenced this pull request Jul 14, 2025
## What

Lazily load fast field dictionaries from buffers: see
paradedb/tantivy#55

## Why

A customer reported slower-than-expected paging on a string/uuid column.
85% of the time for that query was being spent in _opening_ a fast
fields string/bytes column, with a large fraction of that time spent
fully consuming the column's `Dictionary`.

## Tests

See the attached benchmark results:
* [`docs`
dataset](#2842 (review))
    * No regressions.
    * 2x faster for `top_n-score`
    * 1.4x faster for `highlighting` 
* [`logs`
dataset](#2842 (review))
    * No regressions.
    * 4.5x faster for `paging-string-max`
    * 1.7x faster for `paging-string-median`
    * 1.6x faster for `paging-string-min`

The `paging-string-*` benchmarks were added in #2834 to highlight this
particular issue.
stuhood added a commit to paradedb/paradedb that referenced this pull request Jul 14, 2025
Lazily load fast field dictionaries from buffers: see
paradedb/tantivy#55

A customer reported slower-than-expected paging on a string/uuid column.
85% of the time for that query was being spent in _opening_ a fast
fields string/bytes column, with a large fraction of that time spent
fully consuming the column's `Dictionary`.

See the attached benchmark results:
* [`docs`
dataset](#2842 (review))
    * No regressions.
    * 2x faster for `top_n-score`
    * 1.4x faster for `highlighting`
* [`logs`
dataset](#2842 (review))
    * No regressions.
    * 4.5x faster for `paging-string-max`
    * 1.7x faster for `paging-string-median`
    * 1.6x faster for `paging-string-min`

The `paging-string-*` benchmarks were added in #2834 to highlight this
particular issue.
stuhood added a commit to paradedb/paradedb that referenced this pull request Jul 14, 2025
Lazily load fast field dictionaries from buffers: see
paradedb/tantivy#55

A customer reported slower-than-expected paging on a string/uuid column.
85% of the time for that query was being spent in _opening_ a fast
fields string/bytes column, with a large fraction of that time spent
fully consuming the column's `Dictionary`.

See the attached benchmark results:
* [`docs`
dataset](#2842 (review))
    * No regressions.
    * 2x faster for `top_n-score`
    * 1.4x faster for `highlighting`
* [`logs`
dataset](#2842 (review))
    * No regressions.
    * 4.5x faster for `paging-string-max`
    * 1.7x faster for `paging-string-median`
    * 1.6x faster for `paging-string-min`

The `paging-string-*` benchmarks were added in #2834 to highlight this
particular issue.
stuhood added a commit to paradedb/paradedb that referenced this pull request Jul 14, 2025
…2846)

## What

Lazily load fast field dictionaries from buffers: see
paradedb/tantivy#55

## Why

A customer reported slower-than-expected paging on a string/uuid column.
85% of the time for that query was being spent in _opening_ a fast
fields string/bytes column, with a large fraction of that time spent
fully consuming the column's `Dictionary`.

## Tests

See the attached benchmark results:
* [`docs`
dataset](#2842 (review))
    * No regressions.
    * 2x faster for `top_n-score`
    * 1.4x faster for `highlighting`
* [`logs`
dataset](#2842 (review))
    * No regressions.
    * 4.5x faster for `paging-string-max`
    * 1.7x faster for `paging-string-median`
    * 1.6x faster for `paging-string-min`

The `paging-string-*` benchmarks were added in #2834 to highlight this
particular issue.
mdashti pushed a commit that referenced this pull request Oct 21, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
mdashti pushed a commit that referenced this pull request Oct 22, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
mdashti pushed a commit that referenced this pull request Oct 22, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
mdashti pushed a commit that referenced this pull request Dec 3, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
mdashti pushed a commit that referenced this pull request Dec 3, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Dec 3, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Dec 10, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Dec 10, 2025
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Jan 13, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Jan 13, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Jan 13, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
stuhood added a commit that referenced this pull request Jan 14, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
rebasedming pushed a commit that referenced this pull request Feb 10, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
rebasedming pushed a commit that referenced this pull request Feb 10, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.
rebasedming pushed a commit that referenced this pull request Jun 22, 2026
…tionary`. (#55)

When a fast fields string/bytes `Dictionary` is opened, we currently read the entire dictionary from `FileSlice` -> `OwnedBytes`... and then immediately wrap it back into a `FileSlice`.

Switching to `Dictionary::open` preserves the `FileSlice`, such that only the portions of the `Dictionary` which are actually accessed are read from disk/buffers.

(cherry picked from commit d15966f)
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.

2 participants