Add CopyOut! interface for >5x faster data queries#241
Open
cmey wants to merge 7 commits intoJuliaDatabases:masterfrom
Open
Add CopyOut! interface for >5x faster data queries#241cmey wants to merge 7 commits intoJuliaDatabases:masterfrom
cmey wants to merge 7 commits intoJuliaDatabases:masterfrom
Conversation
f13aa0c to
46ab31b
Compare
Author
|
@iamed2 Hi! I'm not sure how to fix the failing formatting CI step, it flags about all source files in the repo, including many I haven't touched 😮 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I tend to do
SELECTqueries that return a large dataset for which the standard method takes a few seconds:PostgreSQL supports the
COPY TOAPI and I found it to be faster, so I implemented it! Use] add https://github.com/cmey/LibPQ.jl#copy-outto try it out!(we already support the
COPY FROMAPI for fast ingestion which I took heavy inspiration from)Both methods return equal outputs:
The new API expects the user to pass a "string builder" type of construct in the form of a
IOBufferthat, during execution, gets filled with the text of the CSV returned by the database.I found this didn't fit well with the table-style of
Result, since this is just a text blob.Note that CSV API changed from CSV version 0.8 to 0.9, and that Julia <1.3.0-1 loads the old CSV, that's why there is the VERSION check in the test code, to support the test run on Julia 1.0.
I hope others will find this helpful! I certainly found this helped me, as I see >10x speed improvement in real-life use cases.