1、概念
某一列唯一鍵的數(shù)量叫做基數(shù)。
2、舉例
性別列,該列只分男女,so 這一列的基數(shù)為2。
3、測試
SYS@orcl> select count(distinct owner),count(distinct object_id),count(*) from t;
COUNT(DISTINCTOWNER) COUNT(DISTINCTOBJECT_ID) COUNT(*)
-------------------- ------------------------ ----------
20 83962 83962
t表的總行數(shù)為83962,owner列的基數(shù)為20,object_id的基數(shù)83962,說明owner列有大量的重復(fù)值。object_id很有可能是主鍵。
SYS@orcl> select owner,count(*) from t group by owner order by 2 desc;
OWNER COUNT(*)
------------------------------ ----------
SYS 37365
PUBLIC 33339
SYSMAN 3554
APEX_030200 2561
ORDSYS 2513
MDSYS 1447
XDB 1167
SYSTEM 611
CTXSYS 389
WMSYS 333
EXFSYS 312
ORDDATA 257
DBSNMP 57
FLOWS_FILES 13
OUTLN 10
ORDPLUGINS 10
ORACLE_OCM 8
SI_INFORMTN_SCHEMA 8
APPQOSSYS 5
ROIDBA 3
20 rows selected.
SYS@orcl>
當(dāng)前題目:優(yōu)化必懂概念-基數(shù)
分享鏈接:
http://weahome.cn/article/ihcjph.html