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