I have to develop one program that consists data manipulation (retrieve data, update data and new insert data) to multiple tables. Which will be suitable approach and faster in performance using DataSet object and stored procedure with CURSOR object? Please point me out. Thanks you all!
Data manipulation is typically faster when done in the DB in the stored procedure.
Unless there is a reason you have to do the manipulation within the application, do it on the DB itself.
I sugget to go for ORM aproach like Entety Framework , LINQ to SQL or Nhibernate you both get better performance and greater development speed.
Related
I may have missed it, but it looks like Snowflake only lets the user define JavaScript UDFs. I don't dislike JavaScript per se, but I have a package containing PL/SQL stored procedures and a couple of functions. I'd like to run these on Snowflake, but would rather not need to convert everything to JavaScript.
Especially because I can't do something like
INSERT INTO...
but now need to do something like
var sql='INSERT INTO...'
Snowflake.execute (sql);
Most of the PL/SQL inserts from one table based off the select from another query. Some functions do bulk fetches. Is there an easier way?
Though Snowflake SQL does not support PL/SQL or native SQL cursors but there are options which can be leveraged for your scenario. Please take a look at below links. Also please be informed that Snowflake's real processing power in terms of performance is when data is processed in bulk instead of processing data row by row.
https://community.snowflake.com/s/question/0D50Z00009f7StWSAU/i-have-written-below-cursor-in-sql-and-working-file-but-i-am-not-able-to-run-the-same-cursor-on-snowflake-please-help
https://docs.snowflake.com/en/user-guide/python-connector-example.html
Snowflake does not support PL/SQL, which is proprietary to Oracle. Looks like the recommended approach is to rewrite the procedures in Python and use Snowflake's Python API.
https://redpillanalytics.com/so-you-want-to-migrate-to-snowflake-part-2/
https://support.snowflake.net/s/question/0D50Z00008nRRhdSAG/i-am-migrating-oracle-plsql-code-into-snowflake-which-is-the-best-way-to-implement-this-using-java-api-or-python-api
Today we got a new direction from management to use only stored procedures instead of SQL queries in Tibco BW. I'm new to tibco and worked only in couple of projects. Can someone help me to understand what added advantage will bring if we use stored procedure in Tibco? Also every process might be using 10 different queries. So if we add that many stored procedures and create indexes and maintain them is it worth on the whole for 50+ processes? I'm having hard time to present Advantages Vs disadvantages
People are used to queries and this is why a lot of times are skeptical when it comes to Stored Procedures. Use your databases' capabilities at its fullest. Do not depend only on your back end programming language. Database programming is very powerful. Stored procedures for complicated logic are usually faster than your typical query. Make sure you plan carefully what the Stored Procedure needs to do and also different scenarios within the stored procedure. Once you get used to it you will not want to do not use them.
The secret is to maintain a current and well written documentation of your stored procedures.
As an organization we are moving towards the purchase of ODI as an ELT tool.
We have plenty of PLSQL resource but I have heard ODI is powerful enough at data manipulation to replace much of what was previously done in PLSQL.
What are its strengths? And weaknesses?
And can it completely do away with coding the data transformation in PLSQL?
No, it doesn't however you might be 99% correct here.
It's actually a tricky question as PL/SQL might be submitted by ODI too.
I would reserve it (PL/SQL) for defining functions/procedures (if you REALLY need to) to be later called by ODI.
This should NEVER be something immediately related to ETL like INSERT INTO … SELECT … FROM … - that's where ODI fits the bill perfectly.
The only justified cases, I came across during my ODI experience (9yrs) were:
- creating PL/SQL function to authenticate (and later authorize through OBIEE) an LDAP/AD user
- creating helper functions to be later called by ODI DQ(CKM) modules like is_number, is_date
- creating XML files directly by DB (even with never ODI XML driver you might still find it's best to use native DB XML API/functionality to produce XML) - for performance reasons. Other direct file operations (load/unload) could be done in this way.
- creating my own (optimized) hierarchy traversal query for performance reasons (beaten the standard Oracle SQL 'Recursive Subquery Factoring' feature to about 1000:1)
It's up to you if you want to make a reusable piece of logic by using PL/SQL and call it from ODI or code it from ODI directly (in the PL/SQL form)
I have a requirement wherein I have to save a large number of parameters from UI to database (Oracle 11g). There's also some business logic involved, so I have decided to use a Stored Procedure. But passing around 100 parameters to stored procedure seems ugly and performance intensive.
There's an option of using Object Types, but that's Oracle specific. Is there a generic solution to tackle this problem?
Even a non stored procedure approach is welcome.
HI ,
I am going to rewrite a store procedure in LINQ.
What this sp is doing is joining 12 tables and get the data and insert it into another table.
it has 7 left outer joins and 4 inner joins.And returns one row of data.
Now question.
1)What is the best way to achieve this joins in linq.
2) do you think this affect performance (its only retrieving one row of data at a given point of time)
Please advice.
Thanks
SNA.
You might want to check this question for the multiple joins. I usually prefer lambda syntax, but YMMV.
As for performance: I doubt the query performance itself will be affected, but there may be some overhead in figuring out the execution plan, since it's such a complicated query. The biggest performance hit will likely be the extra database round trip you will need compared to the stored procedure. If I understand you correctly, your current SP does the SELECT AND INSERT all at once. Using LINQ to SQL or LINQ to Entities, you will need to fetch the data first before you can actually write them to the other table.
So, it depends on your usage if rewriting is warranted. Alternatively, you can add stored procedures to your data model. It will be exposed as a method on your data context.