oracle knowledge
1.oracle view table size
SELECT SUM(T.BYTES) / 1024 / 1024 / 1024
FROM DBA_SEGMENTS T
WHERE T.SEGMENT_NAME = 'TT_TSFR_FUZZY_ABNORMAL';
2. Force full table scan and index
/*+ FULL(TT_CONVEYANCE_DETAIL_UNLOAD)*/ Force full table scan
/*+ INDEX(t,IDX_BATCHCODE_LOCAL)*/ Force index
3.oracle parallel
/*+ PARALLEL(R 3) * /
4. Oracle three table connection methods
Sort merge join USE_MERGE
Application scenario: when the result set has been sorted
select /*+ ordered use_merge(t2)*/count(*)
from test1 t1, test2 t2
where t1.object_id = t2.object_id;
Nested loop USE_NL
Application scenarios:
1. There is a relatively small table in the association;
2. There is an index on the associated field of the associated table;
select /*+leading(t1) use_nl(t2)*/count(*)
from test1 t1, test2 t2
where t1.object_id = t2.object_id;
t1-bit drive table, small amount of data
Hash connection USE_HASH
Application scenarios:
1. The association of a large table and a small table;
2. There is no index on the table;3. The returned result set is relatively large.
t1 is the drive table, the amount of data is small
Oracle Index Classification
Sort by storage method
B-tree index
The leaf nodes of this index hold the index key value and the ROWID pointing to the index row
B-tree indexes can be uniquely qualified as unique indexes
create unique index student_idx on student(number) tablespace users;
Bitmap index
Unlike B-tree indexes, bitmap indexes do not store ROWID values, nor do they store key values. It is an index key entry that stores pointers to multiple rows, i.e. each index entry points to multiple rows.
Bitmap indexes are suitable for application environments with few index base values, high repetition, and read-only, so they are suitable for environments such as data warehouses.
create bitmap index student_bitmap_idx on student (s_sex) tablespace users;
Sort by function
unique index
general index