【发布时间】:2020-06-22 01:39:39
【问题描述】:
我需要使用 Teradata SQL 助手从具有某些条件的数据库中选择一组人。以下哪种方法更快,为什么:
方法A
Create volatile table selection as (
Select *
from table_a
Where id not in (sel id from table_b)
And id not in (sel id from table_c)
And id not in (sel id from table_d)
...
) With data primary index (id) on commit preserve rows;
方法B
Create volatile table selection as (
Select *
from table_a
) With data primary index (id) on commit preserve rows;
Delete from selection where id in (sel id from table_b);
Delete from selection where id in (sel id from table_c);
Delete from selection where id in (sel id from table_d);
【问题讨论】:
标签: sql optimization teradata where-clause sql-delete