System optimization Experience (I.)

Source: Internet
Author: User

Since receiving the responsible operations project, users will always put forward various optimization issues.

Database server, Application Server management by the basis responsible, their own application to view the database execution log is almost impossible, helpless can only constantly look at the code, analysis code, one line.

Take a look at recent problems

The comparison of the ①oracle standard time format is much more efficient than the time in the string format.

②join...on in the back if there is only one condition, use a single-value index

SELECT * from SCF2. A A
INNER JOIN scf2. b b
On b.sessionid = A.sessionid
INNER JOIN scf2. E E
On substr (E.c_pzh, 3, ten) = B.gr_gi_slip_no
WHERE 1 = 1
and b.pstng_date >= ' 2015.01.11 '
and b.pstng_date <= ' 2015.01.12 '
and b.doc_date >= ' 2015.01.01 '
and b.doc_date <= ' 2015.01.12 '
and a.plant = ' 8812 '
and A.status in (' 3 ')
and A.stge_loc = ' 2103 ';

Actually ran for 5 minutes did not see the results show.

Change into

and a.plant = ' 8812 '
and A.status in (' 3 ')
and A.stge_loc = ' 2103 ';
On substr (E.c_pzh, 3, ten) = B.gr_gi_slip_no
WHERE 1 = 1
and To_date (b.pstng_date, ' yyyy.mm.dd ') >=
To_date (' 2015.01.01 ', ' yyyy.mm.dd ')
and To_date (b.pstng_date, ' yyyy.mm.dd ') <=
To_date (' 2015.02.01 ', ' yyyy.mm.dd ')
and To_date (b.doc_date, ' yyyy.mm.dd ') >=
To_date (' 2015.01.01 ', ' yyyy.mm.dd ')
and To_date (b.doc_date, ' yyyy.mm.dd ') <=
To_date (' 2015.02.01 ', ' yyyy.mm.dd ')
and a.plant = ' 8812 '
and A.status in (' 3 ')
and A.stge_loc = ' 2103 ';

And after adding an index based on the requirements, more than 10 s results come out.

System optimization Experience (i)

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.