Yii2模式扫描ALL_OBJECTS而不扫描USER_OBJECTS?
为什么Yii2使用ALL_OBJECTS扫描架构,然后通过OWNER =“owner_name”进行筛选,而不是只扫描USER_OBJECTS?Yii2模式扫描ALL_OBJECTS而不扫描USER_OBJECTS?
由于某些原因,扫描ALL_OBJECTS时执行查询需要很长的执行时间(45秒),查询USER_OBJECTS时需要大约2秒。 (生产环境)
SELECT A.COLUMN_NAME,
A.DATA_TYPE,
A.DATA_PRECISION,
A.DATA_SCALE,
A.DATA_LENGTH,
A.NULLABLE,
A.DATA_DEFAULT,
COM.COMMENTS AS COLUMN_COMMENT
FROM ALL_TAB_COLUMNS A
INNER JOIN ALL_OBJECTS B ON B.OWNER = A.OWNER AND LTRIM(B.OBJECT_NAME) = LTRIM(A.TABLE_NAME)
LEFT JOIN ALL_COL_COMMENTS COM ON (A.OWNER = COM.OWNER AND A.TABLE_NAME = COM.TABLE_NAME AND A.COLUMN_NAME = COM.COLUMN_NAME)
WHERE
A.OWNER = 'owner_name'
AND B.OBJECT_TYPE IN ('TABLE', 'VIEW', 'MATERIALIZED VIEW')
AND B.OBJECT_NAME = 'object_name'
ORDER BY A.COLUMN_ID
由于
回答:
有访问ALL_*
视图/同义词和USER_*
视图/同义词之间的差。
ALL_OBJECTS
描述了当前可用的所有对象,而USER_OBJECTS
仅列出了属于当前用户的对象。
以上是 Yii2模式扫描ALL_OBJECTS而不扫描USER_OBJECTS? 的全部内容, 来源链接: utcz.com/qa/264140.html