对于普通表,我们可以使用select[1] from t选择一行。我怎么能为HDB这么做?
我试过select[1] from t where date=2021.02.25,但是它出错了
Not yet implemented: it probably makes sense, but it’s not defined nor implemented, and needs more thinking about as the language evolves
发布于 2021-02-28 03:34:31
只有当表已经加载到内存中时,select[n]语法才能工作。获得第一行HDB表的最简单方法是:
1#select from t where date=2021.02.25如果应用于已经加载的数据,select[n]将工作。
select[1] from select from t where date=2021.02.25发布于 2021-02-28 09:49:40
我以前通过使用虚拟索引i来执行临时查询,这应该避免了仅仅为了选择几行就将所有数据拖到内存中的成本。如果您的查询需要在提取子集之前首先映射约束,这是一个合理的解决方案。
但是,由于Q查询在封面下的工作方式,它将为所选的每个日期分区提取N行。因此,如果YMMV是在API的后面,这可能不是最好的解决方案。
/ 5 rows (i[5] is the 6th row)
select from t where date=2021.02.25, sum=`abcd, price=1234.5, i<i[5]发布于 2021-03-07 22:43:49
如果表已分区日期,则只需运行
select col1,col2 from t where date=2021.02.25,i=0这将从2021.02.25的分区获得第一条记录,并避免将每条记录加载到内存中。
根据您的第一个请求(与上面的select[1] from t不同),您可以通过
.Q.ind[t;enlist 0]https://stackoverflow.com/questions/66405548
复制相似问题