Question : Question How to improve this query to increase the speed of the query shown below from 30+ seconds […]
Tag: aggregate
How to sort aggregate function call
Question : If I have an expensive function call that takes a JSONB and returns an INT, e.g. CREATE FUNCTION […]
How to check if list of values in one column match list of values in another column (aggregations)
Question : Given two results consisting of single key|value pair (you can imagine those are in CTEs), I want to […]
Type with nested table in oracle
Question : I want to create a type with a nested table. I have a table called assignment_tbl which I […]
How to aggregate in the WHERE clause referencing the subquery from the FROM clause
Question : I got the following query so far: SELECT q1.ID, Content, Volume, CustomerID, runtot FROM ( SELECT ID, Content, […]
How to change aggregate function without duplicating SQL (by using SQL)
Question : In SQL Server 2016 I have a scenario where data will be processed according to different aggregation functions […]
Getting around the constraint “column must appear in the GROUP BY clause or be used in an aggregate function”
Question : I’m using Postgres, which enforces the constraint that all columns in a SELECT…GROUP BY must appear in the […]
Optimizing for data that does not fit in memory
Question : We have a database that contains around 235 GB of data (calculcated using pg_total_relation_size for each table) on […]
Postgresql: Pattern match against array elements?
Question : Is there any way to do a pattern match against the elements of an array in postgresql (9.4 […]
Slow queries related to subqueries using aggregation
Question : Here’s a simplified version of the queries I am running: select … from editions join edition_events on edition_events.edition_id […]