Oracle Temporary table space usage

Source: Internet
Author: User
Tags joins

Today the user to execute a very simple SQL, the output result set is only tens of thousands of, involving three tables, the maximum is only 1 million of the data, the results are reported in the case of lack of table space, theory, such SQL should not eat so many temporary table space.

To query the usage of temporary tablespace:

Select Username,session_num,sql_id,tablespace,segtype,blocks*8192/1024/1024| | ' MB ' as MB from V$sort_usage order BY 6 desc

V$sort_usage displays information for each sort segment of a given instance, only actions that occur in the temporary tablespace will update the view. This is not just a sort action, as long as the temporary table space operation is logged, and the sort occurs in memory, and the view is not updated.

General fixed thinking I would think this SQL has a problem, and then I executed once, immediately thrown out of the abnormal, I immediately reacted to the wrong, because the SQL to take up the temporary table space is a lot of, is gradually 1.1 point request space occupied, this exception thrown too fast, and I went to inquire dba_temp _files, it is because of the design problem, the temporary table space created unreasonable, really is the space is too small for the sake of:

ALTER DATABASE Tempfile XXX autoextend on next 200m MaxSize unlimited;

Several scenarios occupied by temporal tablespace:

1. Order by or group by;

2, the creation and re-creation of the index;

3, DISTINCT, Sort-merge JOINS, HASH join operation;

4, Union & intersect & minus Sort-merge joins;

5. Other abnormal operation

Oracle Temporary table space usage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.