Drop table | QlikView帮助
跳到主要内容

Drop table

上次更新日期:2026/10/7

在脚本执行期间的任何时间,都可以通过 drop table 语句从数据模型(并进而从内存)中删除一个或多个 QlikView 内部表。 (可选)使用 drop mapping table 变体在脚本执行结束前删除映射表——即使用 Mapping 前缀创建的映射表。

drop [mapping] table  tablename [, tablename2 ...]

drop [mapping] tables [ tablename [, tablename2 ...]

信息注释可以同时接受 drop table 和 drop tables 格式。

使用此语句将导致以下项目丢失:

  • 真实表格。
  • 不属于剩余表格部分的全部字段。
  • 剩余字段中的字段值,独立于已删除表格。
示例和结果
示例 结果
drop table Orders, Salesmen, T456a;
这一行将产生从内存中删除的三个表格。
Tab1:
Load * Inline [
Customer, Items, UnitPrice
Bob, 5, 1.50
];
 
Tab2:
LOAD Customer, Sum( Items * UnitPrice ) as Sales
resident Tab1
group by Customer;
 
drop table Tab1;
一旦创建表格 Tab2,则会删除表格 Tab1。
// Load mapping table of country codes:
map1:
mapping LOAD * 
Inline [
CCode, Country
Sw, Sweden
Dk, Denmark
No, Norway
] ;
// Load list of salesmen, mapping country code to country
// If the country code is not in the mapping table, put Rest of the world
Salespersons:
LOAD *, 
ApplyMap('map1', CCode,'Rest of the world') As Country 
Inline [
CCode, Salesperson 
Sw, John
Sw, Mary
Sw, Per 
Dk, Preben
Dk, Olle
No, Ole 
Sf, Risttu] ;
// We don't need the CCode anymore
Drop Field 'CCode';
									
Drop Mapping Table map1;

Metrics:

Load * Inline [
Transaction ID, Sales Amount, Sales Cost, City, Customer ID
1000012, 4509.33, 1234.22, Oslo, 250v9849
1000013, 1043.21, 180.23, Gothenburg, 195d5930
1000014, 6038.35, 1400.10, Copenhagen, 195d5930

];

此示例展示了如何使用 Drop mapping table 变体。创建了一个映射表 map1,然后在后续的 LOAD 语句中与 ApplyMap 函数一起使用。映射表使用后,会从内存中删除,从而优化后续脚本执行表中要加载数据所需的 RAM 使用量。

在这种情况下,映射表只有几行,RAM 优化效果微乎其微。但是,对于大型映射表或在循环中创建映射表时,性能可以显著提高。

本页面有帮助吗?

如果您发现此页面或其内容有任何问题 – 打字错误、遗漏步骤或技术错误 – 请告诉我们!

加入分析现代化计划

Remove banner from view

使用分析现代化计划实现现代化,同时不损害您宝贵的 QlikView 应用程序。 单击此处 了解更多信息或联系: ampquestions@qlik.com