Accelerate SQL return by setting SQLPLUSARRAYSIZE (row prefetch)

Source: Internet
Author: User
Tags prefetch
Sometimes you may use the data in the SQLPLUSspool table. How can you speed up the spool? SQLPLUS has a row prefetch option. In SQLPLUS, arraysize is 15SQ by default.

Sometimes you may use SQLPLUS spool table data. How can you speed up the spool? SQLPLUS has a row prefetch option. In SQLPLUS, arraysize is 15 SQ by default.

Sometimes you may use SQLPLUS spool table data. How can you speed up the spool? SQLPLUS has a row prefetch Option

In SQLPLUS, the default arraysize is 15.

SQL> show arraysize
Arraysize 15

It indicates that only 15 rows of records are transferred from the Oracle server to the client (SQLPLUS) at a time. Of course, JDBC and WEBLOGIC also have row prefetch.

For example:

SQL> select * from test where owner = 'adwu _ OPTIMA_AP11 ';

773 rows selected.

Elapsed: 00:00:30. 95

Execution Plan
----------------------------------------------------------
Plan hash value: 217508114

--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
--------------------------------------------------------------------------
| 0 | select statement | 593 | 134K | 882 (3) | 00:00:03 |
| * 1 | table access full | TEST | 593 | 134K | 882 (3) | 00:00:03 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id ):
---------------------------------------------------

1-filter ("OWNER" = 'adwu _ OPTIMA_AP11 ')


Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
2976 consistent gets
0 physical reads
0 redo size
50484 bytes sent via SQL * Net to client
597 bytes encoded ed via SQL * Net from client
53 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
773 rows processed

SQL> set arraysize 5000
SQL> select * from test where owner = 'adwu _ OPTIMA_AP11 ';

773 rows selected.

Elapsed: 00:00:16. 06

Execution Plan
----------------------------------------------------------
Plan hash value: 217508114

--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
--------------------------------------------------------------------------
| 0 | select statement | 593 | 134K | 882 (3) | 00:00:03 |
| * 1 | table access full | TEST | 593 | 134K | 882 (3) | 00:00:03 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id ):
---------------------------------------------------

1-filter ("OWNER" = 'adwu _ OPTIMA_AP11 ')


Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
2927 consistent gets
0 physical reads
0 redo size
47800 bytes sent via SQL * Net to client
241 bytes encoded ed via SQL * Net from client
2 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
773 rows processed

After setting the arraysize, the number of interactions between the SQLPLUS client and the database Server is significantly reduced, which is why 773 rows of data are returned twice faster than the first time. You can also see that, the second logical read is lower than the first logical read, which means setting row prefetch will affect logical read.

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.