简体   繁体   English

包含列的 SQL Server 索引 - 转换为 Oracle

[英]SQL Server Indexes with Included Columns - convert to Oracle

I'm totally new to SQL Server.我对 SQL Server 完全陌生。 Currently have to convert tables, indexes, triggers and more to Oracle.目前必须将表、索引、触发器等转换为 Oracle。 As far as I know there is no such thing as INCLUDE in Oracle.据我所知,Oracle 中没有INCLUDE这样的东西。 How to convert Indexes with Included Columns to Oracle index please?请如何将包含列的索引转换为 Oracle 索引?

CREATE NONCLUSTERED INDEX [index_name] 
    ON [dbo].[table_name] ([col1] ASC, [col2] ASC)
    INCLUDE ([col3], [col4]) 
    WITH (PAD_INDEX  = OFF...

This is the standard Oracle syntax:这是标准的 Oracle 语法:

CREATE INDEX index_name ON table_name (col1, col2);

Should I simply add col3 and col4 to my index?我应该简单地将 col3 和 col4 添加到我的索引中吗?

There is no SQL Server version.没有 SQL Server 版本。 All I get is files and converting all manually.我得到的只是文件和手动转换。 Thank you All.谢谢你们。

In theory that should work.理论上应该可行。 Include'd columns mean they are not used as predicates during the index seeks (either in join conditions or the where clause), but the data in those columns is available to be returned without a key lookup. Include'd 列意味着它们在索引查找期间不被用作谓词(在连接条件或 where 子句中),但这些列中的数据无需键查找即可返回。

Add the included columns at the end of the existing keys.在现有键的末尾添加包含的列。 Make sure you test out speed and index size as well.确保您还测试了速度和索引大小。

Indexes with Included Columns 包含列的索引

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM