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

Feat/add max result size #3406

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

avallete
Copy link

@avallete avallete commented Mar 19, 2025

Related: #3405

@brianc
Copy link
Owner

brianc commented Mar 20, 2025

I appreciate the work here & the thought...I'm just not sure this is something we should support? It seems very much like a "don't do that query" kinda thing. It's loosely similar to "i wrote an infinite loop in my program. it should automatically abort instead." If your table has rows or columns that are gigabytes in size and you attempt to read them....then it's not gonna work well. I would be surprised if this works well in any database tool...though node is exceptionally limited with ram compared to some desktop tools. What about truncating the column in the query so you only read the first number of characters from the column or something else? This feels to me like code to prevent a problem that is more of a use-case error than an actual bug or feature.

@sehrope
Copy link
Contributor

sehrope commented Mar 20, 2025

Haven't looked through the PR itself to see if it makes sense, but I can see a valid use for something like this when you're not actually sure what SQL the user is executing in advance (e.g., a building a database GUI or report generator that's using this driver to execute the commands). Having it fail and possibly close the connection is okay as long as it's handled gracefully (v.s. the alternative of an OOM killing the node process).

@avallete
Copy link
Author

avallete commented Mar 20, 2025

Hey @brianc !

Thank's for the comment. Indeed, as stated in the issue, the use case here is actually one where the actor "performing the query" and the "database" are two separate entity.

Basically, an example would be an api serving a web client, and proxying the "queries" in and out of the user database. The web-client allowing the user to run arbitrary queries and see the results for it in the browser.

In such case, when a user query can OOM the "api server" accidentally forces the whole machine to die and reboot a new instance which is not ideal. Because then, the user doesn't get it's response but other connections that could be on the same instance from other users will also dies from the OOM.

I could understand if that's not something you're willing to pursue though as it's indeed corner-casy. I opened the PR because of this comment on an older issue mentioning similar problem: #2336 (comment)

Let me know how you want to proceed.

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.

3 participants