LoveUnix » DB2 & Informix » 疑问:alter table VOLATILE CARDINALITY
让LU留住您的每

一天 让LU博客留住您的每一天
2007-11-9 19:37 xn_sung
疑问:alter table VOLATILE CARDINALITY

CARDINALITY关键字起什么作用呢?带和不带CARDINALITY有什么区别啊?

2007-11-11 10:16 beginner-bj
infocenter里肯定有

2007-11-11 22:00 darkbug
[b]VOLATILE CARDINALITY or NOT VOLATILE CARDINALITY [/b]
Indicates to the optimizer whether or not the cardinality of table table-name can vary significantly at run time. Volatility applies to the number of rows in the table, not to the table itself. CARDINALITY is an optional keyword. The default is NOT VOLATILE.

[b]VOLATILE [/b]
Specifies that the cardinality of table table-name can vary significantly at run time, from empty |to large. To access the table, the optimizer will use an index scan (rather than a table scan, regardless of the statistics) if that index is index-only (all referenced columns are in the index), or that index |is able to apply a predicate in the index scan. The list prefetch access method will not be used to access the table. If the table is a typed table, this option is only supported on the root table of the typed table hierarchy (SQLSTATE 428DR).

[b]NOT VOLATILE [/b]
Specifies that the cardinality of table-name is not volatile. Access plans to this table will continue to be based on existing statistics and on the current optimization level.

[[i] 本帖最后由 darkbug 于 2007-11-11 22:03 编辑 [/i]]

2007-11-12 09:05 xn_sung
好像带不带cardinality没什么区别呀!

2007-11-12 12:42 beginner-bj
如果表的记录数变化很快(通常是增长很快)的话,就用的到CARDINALITY。

2007-11-12 17:38 banker
学习一下,不知道实际用的多否

2007-11-12 18:07 xn_sung
[quote]原帖由 [i]beginner-bj[/i] 于 2007-11-12 12:42 发表 [url=http://www.loveunix.com/redirect.php?goto=findpost&pid=735526&ptid=78420][img]http://www.loveunix.com/images/common/back.gif[/img][/url]
如果表的记录数变化很快(通常是增长很快)的话,就用的到CARDINALITY。 [/quote]

VOLATILE
Specifies that the cardinality of table table-name can vary significantly at run time, from empty |to large.

看不加CARDINALITY的解释,也是记录数增长很快啊

2007-11-12 18:08 xn_sung
[quote]原帖由 [i]banker[/i] 于 2007-11-12 17:38 发表 [url=http://www.loveunix.com/redirect.php?goto=findpost&pid=735657&ptid=78420][img]http://www.loveunix.com/images/common/back.gif[/img][/url]
学习一下,不知道实际用的多否 [/quote]
有用,你看一下执行计划,立竿见影

2007-11-13 00:46 beginner-bj
[quote]原帖由 [i]xn_sung[/i] 于 2007-11-12 18:07 发表 [url=http://www.loveunix.net/discuz/redirect.php?goto=findpost&pid=735669&ptid=78420][img]http://www.loveunix.net/discuz/images/common/back.gif[/img][/url]


VOLATILE
Specifies that the cardinality of table table-name can vary significantly at run time, from empty |to large.

看不加CARDINALITY的解释,也是记录数增长很快啊 [/quote]

误会你的意思了。你问的是alter table VOLATILE CARDINALITY 和alter table VOLATILE是什么区别。

答案是没区别。你再读一下darkbug贴的原文。:D

2007-11-13 09:03 xn_sung
呵呵,的确是没区别

2007-11-13 09:36 rinei
看访问计划
强制走索引
否则就走表扫描

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.