【问题标题】:TPC-H queries. Testing and how to run them?TPC-H 查询。测试以及如何运行它们?
【发布时间】:2021-01-03 13:11:11
【问题描述】:

所以我已经生成了 TPC-H 数据。现在我试图在数据库上运行它的查询,但我不知道是应该使用一些特定的值还是应该以某种方式生成它们。

例如,让我们考虑

:x
:o
select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice*(1-l_discount)) as sum_disc_price,
sum(l_extendedprice*(1-l_discount)*(1+l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order

from
lineitem

where
l_shipdate <= date '1998-12-01' - interval ':1' day (3)

group by
l_returnflag,
l_linestatus

order by
l_returnflag,
l_linestatus;
:n-1

这里我不明白:x :o :n-1 的值是什么。当我尝试运行这段代码时,我被要求输入每个值,但我不知道我应该输入什么。或者我应该输入 90 而不是 ':1' 例如?

我正在尝试在 oracle 中执行此操作。

【问题讨论】:

    标签: oracle tpc


    【解决方案1】:

    这只是 Oracle 的观点。

    截至目前:

    l_shipdate <= date '1998-12-01' - interval ':1' day (3)
    

    你的问题是为:1 输入一些值,是的 - 你应该这样做。例如(在 SQL*Plus 中运行),它从 sysdate(今天的日期)中减去 90 天:

    SQL> select sysdate,
      2         sysdate - interval '&1' day (3)
      3  from dual;
    Enter value for 1: 90
    old   2:        sysdate - interval '&1' day (3)
    new   2:        sysdate - interval '90' day (3)
    
    SYSDATE    SYSDATE-IN
    ---------- ----------
    03.01.2021 05.10.2020
    
    SQL>
    

    至于其他值(xon-1)——不知道。如果删除这些行会怎样?

    【讨论】:

    • 当我运行代码时,它会抛出一个输入对话框,我应该在其中输入三个值(对于 x、o、n)。我尝试输入一些值,但它不起作用。例如,我可以在没有这些值的情况下运行代码并将 :1 部分更改为 90,它会正常工作,但我想知道如何使用这三个变量以及它们的用途
    猜你喜欢
    • 2016-01-12
    • 1970-01-01
    • 2015-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多