【发布时间】:2015-12-10 13:56:54
【问题描述】:
我不太擅长 Vertica。请帮助我大致了解如何在 HP Vertica 中找到最接近的投影等效项,以反映每种特定情况下的 Oracle 索引。 前提是我在 Oracle 中有下表
create table new_customers(CustomerId number(10,0), Name varchar2(50), Age number(3,0), State char(2), Address varchar2(50), DateOfBirth date);
还有以下索引:
create unique index new_customers_idx1 on new_customers(CustomerId);
create index new_customers_idx3 on new_customers(name,age desc);
create index new_customers_idx4 on new_customers(extract(month from DateOfBirth));
我用于测试的 HP Vertica 服务器版本是 7.0
1) 所以第一个投影如下所示,对吧?
create projection new_customers_idx1
as
select * from new_customers
ORDER BY CustomerId;
2) 在第二个中,我想没有办法实现降序排序功能,因为根据文档预测仅按升序存储记录。
create projection new_customers_idx3
as
select * from new_customers
ORDER BY Name,Age;
或者在这种情况下,创建投影根本没有意义?
3) 第三个投影是一个主要问题。由于有使用表达式甚至函数的例子是投影的选择列表:
但是我无法像这样创建投影:
create projection new_customers_idx4 AS
select CustomerId,
Name,
Age,
State,
Address,
DateOfBirth,
month(DateOfBirth) as ColAl
from new_customers
ORDER BY ColAl;
错误 4241:SELECT 投影列表中只允许列
请给我关于通过投影实现索引函数的总体提示,有没有什么方法可以创建对应于基于函数的索引的投影?
【问题讨论】:
-
-忘记您从 Oracle 中了解的索引概念,了解分段,加入关键用户,在预测中排序,访问等级。查看 Kermit 链接,它们会带来光明 :)
标签: oracle database-migration projection vertica database-indexes