Select count(*) equivalent in ops?
Closed this issue · 3 comments
I only see a group by followed by a count. Is there a way to receive a scalar value as a result?
You will always receive a table as a result (where you can extract the scalar value). GroupBy without fields and count-function does exactly what "select count(*)" should do.
Ok. Just seems a little convoluted. I would need this mainly for testing purposes. And right now the faster approach for me is, just commenting out the line that writes the result rows in the json object. Therefore, one single operation, just as simple as a NoOp, that just returns the row size. Would that make sense to implement? Or implement it as a json transformation into your suggested plan fragment?
Groupby does the same thing in a little more convoluted way, but will in the end just do three things for non-hashtable, non-fields invocation with the count-expression: create a result table, call table->size(), and fill in that value. The same things you would have to do if you'd do it manually. Unless you are seeing performance problems in the way GroupBy does what it does, I'd suggest using it.