powered by simpleCommunicator - 2.0.53     © 2025 Programmizd 02
Форумы / Oracle [игнор отключен] [закрыт для гостей] / Index_FFS и партиции
9 сообщений из 9, страница 1 из 1
Index_FFS и партиции
    #39936576
brzl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Есть партицированная таблица. На ней индекс. Выборка только по полю индекс не использует FFS.

Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
SQL> drop table hmm;

Table dropped.

SQL> create table hmm(code number(38) not null, key_code number(38) not null) partition by list(key_code) automatic ( partition hmm_p0 values(0));

Table created.

SQL> insert /*+ enable_parallel_dml parallel(4)*/ into hmm
  2  select mod(rownum,500) , mod(rownum, 4) from dual connect by level < 10000000;

9999999 rows created.

SQL> commit;

Commit complete.

SQL> 
SQL> create index hmm_i1 on hmm(code) local parallel 4;

Index created.

SQL> alter index hmm_i1 noparallel;

Index altered.

SQL> 
SQL> explain plan set statement_id = 'HMM' for
  2  select code, count(1) from hmm where key_code = 1 group by code;

Explained.

SQL> set linesize 130
SQL> SELECT *
  2  FROM   TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE','HMM','ADVANCED'));

PLAN_TABLE_OUTPUT                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2298462565                                                                                                       
                                                                                                                                  
----------------------------------------------------------------------------------------------------                              
| Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |                              
----------------------------------------------------------------------------------------------------                              
|   0 | SELECT STATEMENT            |      |   500 |  3500 |   783  (11)| 00:00:01 |       |       |                              
|   1 |  HASH GROUP BY              |      |   500 |  3500 |   783  (11)| 00:00:01 |       |       |                              
|   2 |   PARTITION LIST SINGLE     |      |  2500K|    16M|   714   (3)| 00:00:01 |     2 |     2 |                              
|   3 |    TABLE ACCESS STORAGE FULL| HMM  |  2500K|    16M|   714   (3)| 00:00:01 |     2 |     2 |                              
----------------------------------------------------------------------------------------------------                              
                                                                                                                                  

PLAN_TABLE_OUTPUT                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):                                                                     
-------------------------------------------------------------                                                                     
                                                                                                                                  
   1 - SEL$1                                                                                                                      
   3 - SEL$1 / HMM@SEL$1                                                                                                          
                                                                                                                                  
SQL> explain plan set statement_id = 'HMM' for
  2  select /*+ index_ffs(hmm hmm_i1)*/ code, count(1) from hmm where key_code = 1 group by code;

Explained.

SQL> SELECT *
  2  FROM   TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE','HMM','ADVANCED'));

PLAN_TABLE_OUTPUT                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2298462565                                                                                                       
                                                                                                                                  
----------------------------------------------------------------------------------------------------                              
| Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |                              
----------------------------------------------------------------------------------------------------                              
|   0 | SELECT STATEMENT            |      |   500 |  3500 |   783  (11)| 00:00:01 |       |       |                              
|   1 |  HASH GROUP BY              |      |   500 |  3500 |   783  (11)| 00:00:01 |       |       |                              
|   2 |   PARTITION LIST SINGLE     |      |  2500K|    16M|   714   (3)| 00:00:01 |     2 |     2 |                              
|   3 |    TABLE ACCESS STORAGE FULL| HMM  |  2500K|    16M|   714   (3)| 00:00:01 |     2 |     2 |                              
----------------------------------------------------------------------------------------------------                              
                                                                                                                                  

PLAN_TABLE_OUTPUT                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):                                                                     
-------------------------------------------------------------                                                                     
                                                                                                                                  
   1 - SEL$1                                                                                                                      
   3 - SEL$1 / HMM@SEL$1                                                                                                          
                                                                                                                                  
PLAN_TABLE_OUTPUT                                                                                                                 
----------------------------------------------------------------------------------------------------------------------------------
Total hints for statement: 1 (U - Unused (1))                                                                                     
---------------------------------------------------------------------------                                                       
                                                                                                                                  
   3 -  SEL$1 / HMM@SEL$1                                                                                                         
         U -  index_ffs(hmm hmm_i1)                                                                                               


...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936583
jan2ary
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
brzl,

Так у вас в предикате присутствует поле, которого нет в индексе.
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936591
Фотография -2-
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
jan2ary
Так у вас в предикате присутствует поле, которого нет в индексе.
Значение определяется партицией и условие не препятствует использованию нефаст только IFS.
Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
create table xxx1 (
  n number not null,
  x number not null
) partition by list(n) (
  partition xxx11 values(1),
  partition xxx12 values(2),
  partition xxx13 values(3)
);
create index xxx1i on xxx1 (x) local;

explain plan for select /*+ index_ffs(xxx1 xxx1i) */ x, count(x) from xxx1 where n=2 group by x;
 
------------------------------------------------------------------------------------------------
| Id  | Operation              | Name  | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |       |     1 |    26 |     0   (0)| 00:00:01 |       |       |
|   1 |  SORT GROUP BY NOSORT  |       |     1 |    26 |     0   (0)| 00:00:01 |       |       |
|   2 |   PARTITION LIST SINGLE|       |     1 |    26 |     0   (0)| 00:00:01 |     2 |     2 |
|   3 |    INDEX FULL SCAN     | XXX1I |     1 |    26 |     0   (0)| 00:00:01 |     2 |     2 |
------------------------------------------------------------------------------------------------
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936626
feagor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
brzl,


Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
Connected to Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 

SQL> 
drop table hmm;

Table dropped

create table hmm(code number(38) not null, key_code number(38) not null ) partition by list(key_code)
( partition hmm_p0 values(0),
  partition hmm_p1 values(1),
  partition hmm_p2 values(2),
  partition hmm_p3 values(3));

Table created

create index hmm_i1 on hmm(code) local;

Index created

insert /*+ enable_parallel_dml parallel(4)*/ into hmm
 select mod(rownum,500) , mod(rownum, 4) from dual connect by level < 1000000;

999999 rows inserted

commit;

Commit complete

alter index hmm_i1 noparallel;

Index altered

explain plan set statement_id = 'HMM' for
select code, count(1) from hmm where key_code = 1 group by code;

Explained

SELECT *
FROM   TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE','HMM','ADVANCED'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 2298462565
--------------------------------------------------------------------------------
| Id  | Operation              | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |      |   271K|  6890K|    95  (14)| 00:00:01 |
|   1 |  HASH GROUP BY         |      |   271K|  6890K|    95  (14)| 00:00:01 |
|   2 |   PARTITION LIST SINGLE|      |   271K|  6890K|    83   (2)| 00:00:01 |
|   3 |    TABLE ACCESS FULL   | HMM  |   271K|  6890K|    83   (2)| 00:00:01 |
--------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   3 - SEL$1 / HMM@SEL$1
Outline Data
-------------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
  /*+
      BEGIN_OUTLINE_DATA
      USE_HASH_AGGREGATION(@"SEL$1")
      FULL(@"SEL$1" "HMM"@"SEL$1")
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      DB_VERSION('12.2.0.1')
      OPTIMIZER_FEATURES_ENABLE('12.2.0.1')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=1) "CODE"[NUMBER,22], COUNT(*)[22]
   2 - (rowset=256) "CODE"[NUMBER,22]
   3 - (rowset=256) "CODE"[NUMBER,22]
Note
-----

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
   - dynamic statistics used: dynamic sampling (level=2)

42 rows selected

explain plan set statement_id = 'HMM' for
select /*+ index_ffs(hmm hmm_i1)*/ code,count(code) from hmm partition(hmm_p1) group by code;

Explained

SELECT *
FROM   TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE','HMM','ADVANCED'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 1872405319
--------------------------------------------------------------------------------
| Id  | Operation              | Name   | Rows  | Bytes | Cost (%CPU)| Time
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |        |   271K|  3445K|   598   (3)| 00:00:01
|   1 |  HASH GROUP BY         |        |   271K|  3445K|   598   (3)| 00:00:01
|   2 |   PARTITION LIST SINGLE|        |   271K|  3445K|   586   (1)| 00:00:01
|   3 |    INDEX FAST FULL SCAN| HMM_I1 |   271K|  3445K|   586   (1)| 00:00:01
--------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   3 - SEL$1 / HMM@SEL$1
Outline Data
-------------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
  /*+
      BEGIN_OUTLINE_DATA
      USE_HASH_AGGREGATION(@"SEL$1")
      INDEX_FFS(@"SEL$1" "HMM"@"SEL$1" ("HMM"."CODE"))
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      DB_VERSION('12.2.0.1')
      OPTIMIZER_FEATURES_ENABLE('12.2.0.1')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=1) "CODE"[NUMBER,22], COUNT(*)[22]
   2 - "CODE"[NUMBER,22]
   3 - "CODE"[NUMBER,22]
Note
-----

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
   - dynamic statistics used: dynamic sampling (level=2)

42 rows selected


вот только так получилось почему-то
либо по всем партициям -тоже работает, как только добавляешь предикат доступа к партиции - ломается, хз почему
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936640
feagor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
На металинке нашёл, что пишут
CBO can use a Index Fast Full Scan (INDEX_FFS) as long as the index contains all the columns that are needed for the query, and at least one column in the index key has the NOT NULL constraint. The leading column of an index is not required for an INDEX_FFS to be performed. Note that the use of an INDEX_FFS does not necessarily return the rows in sorted order. Ordering is dependent on the order that the index blocks are read and rows are only guaranteed to be returned in a sorted order if an 'order by' clause is used. See:
видимо даже если поле является ключом для партиций и индекс локальный, исключений не предполагается
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936642
Фотография env
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
brzl,

The optimizer considers this scan when a query only accesses attributes in the index.

Видимо, неявное указание секции не входит в это условие, поэтому второй вариант - создать другой индекс с ключом секции.

Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
SQL>create index hmm_i2 on hmm (key_code, code) local;

Index created.

SQL>explain plan set statement_id ='HMM3' for 
select --+ index_ffs(hmm hmm_i2)
    code,
    count(code)
from
    hmm
where
    key_code = 2
group by
    code;

Explained.

SQL>select * from table(dbms_xplan.display('plan_table', 'HMM3', 'advanced'));

PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                                                                                                                               
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 71265382
 
---------------------------------------------------------------------------------------------------------
| Id  | Operation                      | Name   | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
---------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT               |        |   125 |   875 |  1139   (8)| 00:00:01 |       |       |
|   1 |  HASH GROUP BY                 |        |   125 |   875 |  1139   (8)| 00:00:01 |       |       |
|   2 |   PARTITION LIST SINGLE        |        |  2499K|    16M|  1070   (2)| 00:00:01 |     3 |     3 |
|   3 |    INDEX STORAGE FAST FULL SCAN| HMM_I2 |  2499K|    16M|  1070   (2)| 00:00:01 |     3 |     3 |
---------------------------------------------------------------------------------------------------------
 
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
 
   1 - SEL$1
   3 - SEL$1 / HMM@SEL$1
 
Outline Data
-------------
 
  /*+
      BEGIN_OUTLINE_DATA
      USE_HASH_AGGREGATION(@"SEL$1")
      INDEX_FFS(@"SEL$1" "HMM"@"SEL$1" ("HMM"."KEY_CODE" "HMM"."CODE"))
      OUTLINE_LEAF(@"SEL$1")
      ALL_ROWS
      OPT_PARAM('_optimizer_nlj_hj_adaptive_join' 'false')
      OPT_PARAM('_optimizer_strans_adaptive_pruning' 'false')
      OPT_PARAM('_px_adaptive_dist_method' 'off')
      OPT_PARAM('_optimizer_use_feedback' 'false')
      DB_VERSION('19.1.0')
      OPTIMIZER_FEATURES_ENABLE('19.1.0')
      IGNORE_OPTIM_EMBEDDED_HINTS
      END_OUTLINE_DATA
  */
 
Column Projection Information (identified by operation id):
-----------------------------------------------------------
 
   1 - (#keys=1) "CODE"[NUMBER,22], COUNT(*)[22]
   2 - "CODE"[NUMBER,22]
   3 - "CODE"[NUMBER,22]
 
Hint Report (identified by operation id / Query Block Name / Object Alias):
Total hints for statement: 1
---------------------------------------------------------------------------
 
   3 -  SEL$1 / HMM@SEL$1
           -  index_ffs(hmm hmm_i2)
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936715
Alexander Anokhin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
feagor
brzl,


Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
select code, count(1) from hmm where key_code = 1 group by code;

--------------------------------------------------------------------------------
| Id  | Operation              | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |      |   271K|  6890K|    95  (14)| 00:00:01 |
|   1 |  HASH GROUP BY         |      |   271K|  6890K|    95  (14)| 00:00:01 |
|   2 |   PARTITION LIST SINGLE|      |   271K|  6890K|    83   (2)| 00:00:01 |
|   3 |    TABLE ACCESS FULL   | HMM  |   271K|  6890K|    83   (2)| 00:00:01 |
--------------------------------------------------------------------------------


select /*+ index_ffs(hmm hmm_i1)*/ code,count(code) from hmm partition(hmm_p1) group by code;

--------------------------------------------------------------------------------
| Id  | Operation              | Name   | Rows  | Bytes | Cost (%CPU)| Time
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |        |   271K|  3445K|   598   (3)| 00:00:01
|   1 |  HASH GROUP BY         |        |   271K|  3445K|   598   (3)| 00:00:01
|   2 |   PARTITION LIST SINGLE|        |   271K|  3445K|   586   (1)| 00:00:01
|   3 |    INDEX FAST FULL SCAN| HMM_I1 |   271K|  3445K|   586   (1)| 00:00:01
--------------------------------------------------------------------------------


вот только так получилось почему-то
либо по всем партициям -тоже работает, как только добавляешь предикат доступа к партиции - ломается, хз почему


Путь к нужной партиции можно сократить немного
Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
 select --+ index_ffs(hmm)
        code, 
        count(1) 
   from hmm partition for (1)
  group by code;

-------------------------------------------------
| Id  | Operation                      | Name   |
-------------------------------------------------
|   0 | SELECT STATEMENT               |        |
|   1 |  SORT GROUP BY                 |        |
|   2 |   PARTITION LIST SINGLE        |        |
|   3 |    INDEX STORAGE FAST FULL SCAN| HMM_I1 |
-------------------------------------------------
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936741
Alexander Anokhin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Предполагаю, что проблема в том, что в общем случае в партиции может быть много значений. И для частного случая, где значение в партиции одно и оно же в предикате есть оптимизация для index range/full scan, где оракл понимает, что индекса достаточно и доступ к таблице не нужен, но даже этой оптимизации нет за пределами частного случая

Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
create table hmm(code number(38) not null, key_code number(38) not null) partition by list(key_code) automatic (partition hmm_p0 values(0));

...

 select --+ index(hmm)
        count(*)
   from hmm 
  where key_code in (0,1);

------------------------------------------------------------------------------
| Id  | Operation                                   | Name   | Pstart| Pstop |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                            |        |       |       |
|   1 |  SORT AGGREGATE                             |        |       |       |
|   2 |   PARTITION LIST INLIST                     |        |KEY(I) |KEY(I) |
|   3 |    TABLE ACCESS BY LOCAL INDEX ROWID BATCHED| HMM    |KEY(I) |KEY(I) |
|   4 |     INDEX FULL SCAN                         | HMM_I1 |KEY(I) |KEY(I) |
------------------------------------------------------------------------------
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=0) COUNT(*)[22]
   4 - "HMM".ROWID[ROWID,10]


create table hmm(code number(38) not null, key_code number(38) not null) partition by list(key_code) automatic (partition hmm_p0 values(0,1));

...

 select --+ index(hmm)
        count(*)
   from hmm 
  where key_code in (0,1);

------------------------------------------------------------------------------
| Id  | Operation                                   | Name   | Pstart| Pstop |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                            |        |       |       |
|   1 |  SORT AGGREGATE                             |        |       |       |
|   2 |   PARTITION LIST INLIST                     |        |KEY(I) |KEY(I) |
|   3 |    TABLE ACCESS BY LOCAL INDEX ROWID BATCHED| HMM    |KEY(I) |KEY(I) |
|   4 |     INDEX FULL SCAN                         | HMM_I1 |KEY(I) |KEY(I) |
------------------------------------------------------------------------------
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=0) COUNT(*)[22]
   4 - "HMM".ROWID[ROWID,10]



ну а для index fast full scan этой оптимизации и для частного случая нет.
...
Рейтинг: 0 / 0
Index_FFS и партиции
    #39936759
Alexander Anokhin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Похоже предыдущий мой пример не совсем верный. Там шаг 3 появляется не из-за нескольких значений, а из-за PARTITION LIST INLIST и KEY(I) как результат.
Вот так, например, снова нет избытоного шага

Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
create table hmm(code number(38) not null, key_code number(38) not null) partition by list(key_code) automatic 
(partition hmm_p0 values(0));

...

 select --+ index(hmm)
        count(*)
   from hmm 
  where key_code between 0 and 1;


-----------------------------------------------------------
| Id  | Operation                | Name   | Pstart| Pstop |
-----------------------------------------------------------
|   0 | SELECT STATEMENT         |        |       |       |
|   1 |  SORT AGGREGATE          |        |       |       |
|   2 |   PARTITION LIST ITERATOR|        |     1 |     2 |
|   3 |    INDEX FULL SCAN       | HMM_I1 |     1 |     2 |
-----------------------------------------------------------
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=0) COUNT(*)[22]

create table hmm(code number(38) not null, key_code number(38) not null) partition by list(key_code) automatic 
(partition hmm_p0 values(0,1));

...

 select --+ index(hmm)
        count(*)
   from hmm 
  where key_code between 0 and 1;

---------------------------------------------------------
| Id  | Operation              | Name   | Pstart| Pstop |
---------------------------------------------------------
|   0 | SELECT STATEMENT       |        |       |       |
|   1 |  SORT AGGREGATE        |        |       |       |
|   2 |   PARTITION LIST SINGLE|        |     1 |     1 |
|   3 |    INDEX FULL SCAN     | HMM_I1 |     1 |     1 |
---------------------------------------------------------
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - (#keys=0) COUNT(*)[22]



но Index Fast Full Scan работать по прежнему не будет.
...
Рейтинг: 0 / 0
9 сообщений из 9, страница 1 из 1
Форумы / Oracle [игнор отключен] [закрыт для гостей] / Index_FFS и партиции
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]