Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf improvements #46

Merged
merged 2 commits into from
Dec 23, 2022
Merged

Perf improvements #46

merged 2 commits into from
Dec 23, 2022

Conversation

EdMcBane
Copy link
Contributor

What kind of change does this PR introduce?

A new iter_scan method to reuse a borrowed Row; a few additional performance improvements.

What is the current behavior?

ForeignDataWrapper::iter_scan requires the implementor to build a Row, which is quite expensive.

What is the new behavior?

ForeignDataWrapper::iter_scan_borrowed takes a mutable ref to a Row owned by the caller; the implementor just needs to populate it.
A default implementation is provided that simply delegates to ForeignDataWrapper::iter_scan and swaps the returned Row.

Additional context

On my machine (intel 8700k), in release mode, pg15, with a sample FDW that yields 10M "helloworld" rows, the time taken to execute SELECT * FROM bench WHERE id < 0 are:

  • Original: 3244,732 ms (00:03,245)
  • Without debug2! on iter_scan: 1565,417 ms (00:01,565)
  • Reusing Row: 1241,977 ms (00:01,242)

I've been unable to run the tests on this, the docs seem out of date and cargo test fails to compile.

@EdMcBane
Copy link
Contributor Author

Example wrapper used for "benchmarks"

https://github.com/EdMcBane/wrappers_bench

@burmecia
Copy link
Member

That's great improvement, thanks @EdMcBane ! I think this should be the default interface and we will make it in the next release.

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