Problem solve Get help with specific problems with your technologies, process and projects.

How can SQL statements help a query's performance?

I created indexes on our database tables to increase performance of a query retrieval. How can I increase performance of the inserted SQL statements?
Adding indexes may or may not help your query performance. Simply adding them is not enough; you need to test your SQL statements to ensure that the index is helping your query performance. In some cases, an index may actually hamper performance.

One of the problems with indexes is that too many of them can hamper DML (insert, update, delete) performance. DML operations may require the index to be updated as a result. Too many indexes can cause too much work. So it is wise to not overindex your tables. If you are having problems with INSERT performance, drop any unused indexes.

There is not much you can do for INSERT performance if your INSERT statement is like the following:

INSERT INTO my_table VALUES (1,2,3,4);
I have seen some DBAs add more freelists to their table to help INSERT performance, but it is rare that more freelists are required. If there are multiple INSERT statements in your application, then bind variables can definitely help.

Let's suppose your INSERT statement has a subquery, similar to the following:

INSERT INTO my_table SELECT colX, colY, colZ FROM your_table;
In this case, you can help your INSERT performance by tuning the subquery. Tune the SELECT statement and your INSERT performance will improve.

Dig Deeper on Oracle database performance problems and tuning

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.