How to bind a variable to an OLTP OR OLAP

Source: Internet
Author: User
Tags bind variables

I'm not going to introduce the concepts of OLTP and OLAP here, and these are the same DBAs that are required to understand. Today's topic is why binding variables fit in OLTP systems rather than OLAP systems. In some ways, we can look at OLTP and OLAP systems like this, OLTP system small query many and OLAP systems are basically large queries, and their fatal difference is the execution time (the result set is very different), so we can also say that the OLTP system suitable for short queries, OLAP system is suitable for long queries. Anyway, in an OLTP system, we need to focus on the fast execution of small queries, one of the optimizations that can be done is to increase the SQL hit rate, use the index (index access small result set), and the binding variable feature just improves the frequency of SQL reuse and reduces the number of repeated resolutions. And then greatly reduce the consumption of system resources. In OLAP systems, report class queries often have aggregate sorting operations, is generally a huge result set, where the consumption of the system resources can be ignored, in order to speed up the query optimization purposes, we have to pay attention to the implementation of the plan of the correct choice, and the use of binding variables is likely to let the CBO choose the wrong execution plan, So it is not suitable for use.

The following example looks at the effect of binding variables on OLTP and OLAP systems.

The following is a brief introduction to the impact under OLAP systems:

--I have a big watch.

Luocs@maa> Select COUNT (*) from TT1;

COUNT (*)

----------

338752

Luocs@maa> Select Index_name, Index_type, status from User_indexes where table_name= ' TT1 ';

Index_name Index_type STATUS

--------------- --------------- ----------------

Inx_tt1_owner BITMAP VALID

Luocs@maa> Select column_name, num_distinct from User_tab_cols where table_name= ' TT1 ';

column_name num_distinct

------------------------------------------------------------ ------------

OWNER 15

object_name 16272

Subobject_name 333

OBJECT_ID 21204

data_object_id 6221

Object_type 36

CREATED 855

Last_ddl_time 907

TIMESTAMP 935

STATUS 1

Temporary 2

Generated 2

Secondary 2

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.