How do I obtain a Query Execution Plan in Oracle IDEs? - sql

In Oracle IDEs, such as Navigator, Toad, Oracle SqlDeveloper how can I get a query execution plan for a query / stored procedure?
I can find some commands for them online, even though I am not able to use them sometimes, but is there any functionality/tools built-in for these IDE's for that purpose?

Here's for TOAD and SQL Developer; don't know about other tools as I don't use them.

Here are the ones I have found.
For navigator:
Or from Tools-Explain Plan Tolls
And I found out another tool for getting SQL Plan too. It has been of great help to me. It's
Dell™ SQL Optimizer for Oracle®
There, you can simply write your query, and it will both find better versions of it and show and compare their plans too.

Related

Query plan for MDX query?

I have been slowly trying to learn MDX coming from a background of using SQL. In DBMSs such as PostgreSQL, one can get a query plan for their query e.g. using EXPLAIN. Is this possible in any version of MDX and if so, how? I have not managed to come across something of this nature.
Not exactly a query plan, but DMVs and profiler will be helpful. The profiler can be launched from management studio, Tools.

Is there a tool, which will give information about a sqlite query performance to help in index creation?

I've seen the sql server execution plan and the mysql explain, which give details about where queries are not performing as well as they might. I think I need to create some indexes, but I'm not sure where.
Is there a tool for sqlite ?
Don't mind if its on the mac or windows.
SQLite has a built-in query explain statement. You probably want EXPLAIN QUERY PLAN.

converting stored procedures from sql server to oracle

We have a massive amount of stored procedures to convert from sql-server 2000 to oracle 10g. Does anyone know of any tool that would achieve this?
We used Oracle SQL developer for this but it seems like it is creating extra cursors for each IF/ELSE condition that was on sql server side.
Has anyone successfully used a tool that would do this?
Sorry, no answer, and you have my sympathies. I've been through this before and it was all manual. We ended up making distinct migration & test plan tasks for it.
Oracle will use cursors in places that look odd for people used to SQL server. I am not aware of any (simple) way around this.
There seem to be a number of companies out there now offering services or tools to help: This Google search shows a bunch.
Don't forget to plan for functional equivalence testing. Datatype differences may cause issues, and your application development tool(s) may interact differently with Oracle than they do with SQL server. I did this conversion a number of years ago for a PowerBuilder application, and a lot more of that needed updating than we expected.

Powerful tools for creating SQL queries

I'm looking for a tool, which would help creating complex SQL queries. Sometimes it's difficult to even verify, whether the results of a query are correct. It's especially easy to get queries joining several tables to return too little or too much data.
The tool should enable at least creation of test tables, some kind of visualization how the queries gather their data and hopefully give better parsing of error cases than for example Oracle does.
Are there tools like this or do I have to stick with creating test tables manually, filling them with test data and commiting all kinds of queries with SQuirrel SQL?
When you have a very complex query it is usually easiest to validate by breaking it up into multiple queries that populate temp tables. These intermediary results can be individually verified and then you bring them together to produce the final result set. Depending on performance needs you can stick with the temp table approach or you can then rewrite to a single statement. Typically when I have a huge query it is for background processing so I stick with the temp table approach.
What RDBMS are you using? All of the major ones have some type of console available (e.g.-SSMS in SQL Server, Toad in Oracle, MySQL Query Browser/Administrator for MySQL, etc.), and they all have Query Execution Plans where you can see how the query will actually run. So, the answer to your question is that it's entirely dependent on what RDBMS you're using, but the safe bet answer is: Yes.
I recommend trying SQL Server 2008 Management Studio Express (SSMSE) if you are working with SQL Server. I have used it at work and I believe it does everything you are looking for.
You can get it and SQL Server (express editions) here.
Certainly not a free, open-source solution, but I believe Quest Software's TOAD will fit your requirements. Quest seems to offer alot of tools in that space...they have tools for modeling and analysis, however I've never used the modeler or analyzer.
I personally have experience with the commercial version of TOAD for Oracle. It's GUI is overwhelming at first, but after you mentally filter out all of the extra buttons that you'll never use, it's manageable.

What tools are available to test SQL statement performance?

In the never-ending search for performance (and my own bludgeoning experience), I've learnt a few things that could drag down the performance of a SQL statement.
Obsessive Compulsive Subqueries Disorder
Doing crazy type conversions (and nest those into oblivion)
Group By on aggregate functions of said crazy type conversions
Where fldID in (select EVERYTHING from my 5mil record table)
I typically work with MSSQL. What tools are available to test the performance of a SQL statement? Are these tools built in and specific to each type of DB server? Or are there general tools available?
SQL Profiler (built-in): Monitoring with SQL Profiler
SQL Benchmark Pro (Commercial)
SQL Server 2008 has the new Data Collector
SQL Server 2005 (onwards) has a missing indexes Dynamic Management View (DMV) which can be quite useful (but only for query plans currently in the plan cache): About the Missing Indexes Feature.
There is also the SQL Server Database Engine Tuning Advisor which does a reasonable job (just don't implement everything it suggests!)
I mostly just use Profiler and the execution plan viewer
Execution Plans are one of the first things to look at when debugging query performance problems. An execution plan will tell you how much time is roughly spent in each portion of your query, and can be used to quickly identify if you are missing indexes or have expensive joins or loops.
MSSQL has a database tuning advisor that will often recommend indexes for tables based upon common queries run during the tuning period, however it wo't rewrite a query for you.
In my opinion, experience and experimentation are the best tools for writing good SQL queries.
In mysql (may be in other databases too) you can EXPLAIN your query to see what database server thinks about it. This usually used to deside which indexes should be created. And this one is build-in, so you can use it without installing additional software.
Adam Machanic has a simple tool called SqlQueryStress that might be of use. It is designed to be used to "run a quick performance test against a single query, in order to test ideas or validate changes".