CTAS reorganization table

xiaoxiao2021-03-06  210

A total of 1 million records of the MOT_C_DATA table is 650M

Among them, there is Bitmap Index on Activity? It has two values ​​0? And 1 ?? 1 is about 10,000

Now I want

Select * from mot_c_data where activity = '1';

Expain Plan

Do not use index ?? and bytes is 150M

Then I am in force INDEX

SELECT / * INDEX (MOT_C_DATA) * / * from Mot_c_data where activty = '1';

But it is not seen, and Bytes is still 150m.

All I use CTAS to reorganize this table

Create Table Mot_c_data_bak assect from mot_c_data order by activity;

Drop Table Mot_c_data;

ALTER TABLE MOT_C_DATA_BAK RENAME To MOT_C_DATA;

then

Select * from mot_c_data where activity = '1';

Many Bytes is only 20m;

转载请注明原文地址:https://www.9cbs.com/read-128886.html

New Post(0)