r/GoogleAppsScript • • Sep 02 '25

Question V8 Runtime JDBC query Speed Issue

Post image

We’re struggling with a thing at work that maybe Reddit will be able to help with when Google Cloud, Workspace and other forums haven’t been able to.

So we have a bunch of app scripts that rely on JDBC queries to databases. They run quite smoothly now on Rhino runtime. When we switch to the V8 runtime, the queries seem to take literally 50x+ longer to run. In most cases any kind of real complicated query just times out, but even our simple ones that used to take 4 seconds to run now take 4 minutes, which essentially renders them useless because users are just not waiting that long because they close the process out. There’s some options for us to switch some of the bigger queries to power shell or something else but some of these just don’t have any other options but to use JDBC queries in app script.

Google cloud support acknowledged that it is a problem and they’re working on it, but this has been a problem for years and they’re still moving forward with mandating V8 in January and we have no other options for the dozens of processes we do that rely on these runtimes. Anyone have any thoughts or solutions that work? We attempted the JDBCX option that was mentioned in some Google forums but it only decreased the run time from say 4 minutes to 3 minutes and 45 seconds or some insignificant amount.

Most of our queries are complex, but I replicated the issue in a simple query attached to this post so you get the idea.

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/marcnotmark925 Sep 03 '25

Ok just making sure.

Yah for writes there's nothing about json. But I'd recommend batching together as many writes as you can. And I don't mean a jdbc batch statement, I mean big single queries that affect multiple records. And there is a max character length to consider for a single statement, but I'm pretty sure I've queried json agg arrays on extremely large tables before without any such memory limit issues.

1

u/ItsMeElmo Sep 03 '25

Thanks for the advice!