Ask the Expert

In Oracle, does the number of columns in a table affect the performance during SELECT/INSERT/UPDATE?

Does the number of columns in a table affect the performance during SELECT/INSERT/UPDATE? If so, is there any reason?

    Requires Free Membership to View

For SELECT statements, the number of columns will not affect the performance. The reason is that Oracle has to read data at the block level. The entire row, or multiple rows if the block contains more than one, will be read into the buffer cache. Oracle will first determine which rows satisfy your query. At this point, Oracle removes the unwanted rows from the result set before it passes the results back to the user. So whether you have one column or all columns from a table in a SELECT statement, it will not affect the statement's performance.

Similarly for an UPDATE statement. Oracle must read the entire block into memory and then modify the row's contents. If the row increases in length due to the UPDATE statement and the row has to be migrated or chained, the statement will take longer to process. But this is true no matter how many columns are modified. Finally, it will be quicker to update all columns at once than to break the statement into multiple UPDATE statements.

The INSERT statement can take longer to complete the more data you insert. This has to do with the entire row length rather than the number of columns involved. But you shouldn't see any noticeable difference involved. If your INSERT statement is taking a long time, there are probably other factors at work.

This was first published in May 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: