i have lots of query with select and update. i want to execute it automatically in Oracle SQL developer. I also want to note the execution time of each query.
Please suggest way.
Thanks in advance.
Related
Hello i have SQL with few left joins and cases. Time on postgres is around one second and on oracle is 20minuts! (390 row postgres, 300 rows oracle). Configuration of tables are the same in both db. If i run in oracle EXPLAIN PLAN FOR for this sql first, then when i run SQL (without EPF) it is fast as on postgres. I can even make some changes, add colums etc and it still run nice and fast.
Is here someone who understand what is this and what solution i can use in java where query is used?
I have some Power BI queries which are very slow and causing issues on our server. It was suggested that I use No Lock. I've used this in SQL, but I can't find any way to do this in Power BI. Does anyone know how to do this?
Thanks
I would write SQL SELECT statements to start each Query, using the NOLOCK hint. Then I would paste those into the Get Data / SQL Server / Advanced / SQL Statement box.
You may be able to avoid this by optimising your Query steps to make them run faster, e.g. moving SQL-translatable steps like Filter, Group By, Remove Columns etc as far up the Steps list as possible.
Let‘s say we have got a large number of SQL queries which take a long time to run. Now, we would like to make some changes to the database and re-execute the queries. We could rerun everything, but I would prefer a solution where only those queries are executed which are affected by the changes.
Do you know of any method to obtain the relevant tables/columns for each query? A simple example would be:
(let's consider this table: TABLE1 with columns: A;B;C)
SELECT C FROM TABLE1 WHERE B>10;
I would like to know that TABLE1.B is participating in this query.
Edit: the database is HSQLDB and is used from Java via JDBC.
Are you using any workbenck to execute your sql queries ? In Mysql workbench you have query optimizer option under which you can check which query has excuter and what actions has performed with the query result in a tree block diagram which certainly helps you here and you can also parse your query and check your resuls in query optimizer :) Hope it helps to you.
I would like to know if there is any tool which will give me the optimized SQL query for which ever query I specify. So that I can improve my DB as well as query performance. I use SQL Server 2008.
Thanks in advance.
The old Rule of DBs still applies, don't try to optimize sql statements, since the DB query parser will do its own optimizations anyway, instead do right away what we all do in the end:
Create indexes to increase performance
Don't get me wrong of course sql queries can be written stupidly and will therefore perform badly, but as long as you created a sensable 'normal' query, the query optimizer will do the rest together with the indexes.
SQL Server will even tell you if a query will clearly benefit from an index when you look at the execution plan. It will even generate the DDL statement to create the index, so all you have to do is copy/paste and run it to have the index your query needs.
You can already watch the execution plan that gives you SQL Server Management Studio.
You can try Redgate, they have evaluation versions for most of their products:
Redgate Website
SQL Server 2005 and up comes with a Query Optimizer. This can help, but tools can't really do too much optimization suggesting for you because they don't know what you are trying to accomplish.
You might try taking a look instead at some ways in which you can optimize your queries. Here are some links to get you started.
Tips, Tricks, and Advice from the MS SQL Query Optimization Team
SQL Server Rules for Optimizing Queries, best practices
Statistics Used by the Query Optimizer in SQL Server 2008
SQL Server 7.0 / 2000 came with 'index tuning wizard' this functionality has been around for a long time.
I'd reccomend having a look at 'select * from sys.dm_db_missing_index_details'
It tells you which indexes are 'missing', it's trivial to look in that table and then create indexes
i have four queries, all of which are valid and they do the same work.
how to find out which one is the most optimal?
i'm using oracle 10g.
is there any method like finding time complexity of a program?
One of the parameters to measure is the performance of the query. For oracle you can use Explain Plan. Check out the details below -
http://www.adp-gmbh.ch/ora/explainplan.html
http://download.oracle.com/docs/cd/B10500_01/server.920/a96533/ex_plan.htm
If you use MySQL, i think that most practical method to compare queries efficiency is BENCHMARK() query.
If you're using Microsoft SQL Server you could use SQL Management Studio to look at the queries' Execution Plans, or even run a SQL Profiler trace.
Generate the execution plan (e.g. using EXPLAIN PLAN) and compare the costs of the different statements.