Reputation: 21
Are the snowflake procedures written in Javascript precompiled. I am noticing for the procedure is compiling for each invocation. Any thought?
Also, Is it wise to use SnowFlake SQL or Java for procedures in production given the fact that they are in Preview?
Upvotes: 0
Views: 328
Reputation: 25903
JavaScript is not a compiled language. But then again nether is SQL, but many DB's have "pre-compiled SQL procedures" and "pre-compiled SQL". Snowflake does not have "pre-compiled" SQL. But Java is compiled.
Which is a long way of saying, NO the SQL/JavaScript is evaluated on every run "presently", and thus not "compiled"
But really if you are using a JavaScript procedure over 10 rows, yes the compile time will be a big factor. If you are using a Javascript function over a data set that is a 1 billion rows read from file, and filtered down to 1 million rows, the "cost" of the JavaScript across those rows, will be invisible compared the the data read.
So as with EVERYTHING, there is no generalized answer, you should test your performance, and when it's "good enough" more on to the next feature/expensive function/procedure.
Probably not, at the edge case, yes, just like in the real world should any project be in Java instead of written in JavaScript. One is fast to develop, the other is very slow to develop. One can be fast when, the other can use libraries (there are no libraries in Snowflake SP). Anyways, I would "get a working solution" and then optimize to "slow" bits, once you see them. Verse trying to up front write the best thing once.
Upvotes: 2