Comments (7)
I'd prefere more generic option to achieve this.
I.e. we already have compact(istore)
and istore_val_larger(istore, istore)
How about adding istore_val_larger(istore, int)
so that
SELECT istore_val_larger({1 => 2, 2 => -3, 3 => -1, 4 => -3}, 0)
gives
{1 => 2}
on could then SUM(istore_val_larger(istore_col,int)
to achieve the same.
functionality would be the same as clamp_below
just with values instead of keys
from istore.
I think @alexeyklyukin is already working on this in #86. Problem with these functions that the function should make another istore and allocate more memory on each tuple.
from istore.
Yeah my thinking was this function would be more efficient than creating new istores and summing.
I can see two ways of looking at this.
- With faster hardware, we need to worry less about this efficiency.
- With faster hardware, we are catching up with the hardware fast enough to make this have a possibly significant difference.
from istore.
well efficiency is always good, I was just wondering about the use cases because this alone seems not to be a full api you might also want to check equality or less than, so maybe
sum_if_val(istorecol, op, int)
would be a more flexible thing ?
SELECT sum_if_val(col, '>', 0)
Not sure how the implementation would end up performance wise though
from istore.
Thinking about the performance, it could be better to just generate the code for each operator, and in the end we will have five different functions like: sum_gt
, sum_gte
, sum_eq
, sum_lt
and sum_lte
. And same for other aggregation functions.
from istore.
In the vast majority of cases we aggregate with the sum
; the idea of a specialized aggregate here comes from the desire to avoid doing two passes over a single istore
(one to correct values and another to accumulate values for the keys) and allocate memory for the istores
that don't need to be changed.
The less-common cases are covered by #86: one can filter on istore_in_range
function before passing the istore
to the respective aggregate or apply istore_floor
/istore_ceiling
ones to correct them.
from istore.
Not sure this is needed anymore or has a legitimate use case. closing.
from istore.
Related Issues (13)
- cistore
- scount
- remove compiler warnings
- missing equality operator
- int overflow for big istore fetch HOT 2
- Operator istore - int[] HOT 5
- postgres 9.2 HOT 2
- Introduce functions to control the upper and lower boundaries of the values in istore HOT 2
- build failure with postgresql-12 HOT 4
- istore precludes parallel queries
- Istore multiplication is not very friendly
- potential int overflow in clamp_below
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from istore.