a stored proc is just a query saved on the db server, nothing more
if you destructure a stored proc to multiple individual queries, ok, sure, but who would do that?
a stored proc is just a query saved on the db server, nothing more
if you destructure a stored proc to multiple individual queries, ok, sure, but who would do that?
Obviously if you just take a single query and turn it into a stored procedure then yes, the round-trip cost is the same. This seems to be where your knowledge ends. Perhaps we can expand that a bit.
Let's look at a more involved example with procedural logic. This would be many, many round trips.
https://www.red-gate.com/simple-talk/databases/sql-server/t-...
I'm not exactly endorsing that example. Personally, I would almost never choose to put so much of my application logic into a stored procedure, at least not as a first choice. This is just an example of what's possible and not something I am endorsing as a general purpose best practice.
With that caveat in mind, what's shown there is going to be pretty performant compared to a bunch of round trips. Especially if you consider something like that might need to be wrapped in a transaction that is going to block other operations.
Also, while you may be balking at that primitive T-SQL, remember that you can write stored procedures in modern languages like Python.
https://docs.snowflake.com/en/sql-reference/stored-procedure...
powerful stuff
Sometimes folks know more about a given thing than you do. That is okay. The goal is to learn. I am sure you know more than I do about zillions of things. In fact, that is why I come here. People here know things.
i hope you reflect on this interaction at some point
a stored proc is just a query saved on the db server, nothing more
Absolutely not. They can contain procedural logic as well. You can do a wide range of things in a stored proc that are far beyond what can be done with a query. Again.... I provided some links with examples. You don't need to believe me. i hope you reflect on this interaction at some point
Wow.Not, if you want to spread the queries over multiple transactions.