The document discusses different SQL grouping functions - CUBE, ROLLUP, and GROUPING SETS - that can be used to generate summary reports from sales data. It shows examples using each function and the results they produce. CUBE returns all possible combinations of groups, including subtotals and totals. ROLLUP moves from specific to general along a hierarchy. GROUPING SETS allows specifying precise groups to include without unwanted combinations. The examples demonstrate how these functions can be used to analyze and report on quarterly and annual sales totals by employee.
Hierarchies are the bread and butter of most business applications and you find them almost everywhere:
* Product Categories
* Sales Territories
* Calendar and Time
Even when there is a big need from a business perspective, the solutions in relational databases are still sort of awkward. Since Version 2008 SQL Server makes live a bit easier with data type hierarchyid. To make use of aggregations you have to master GROUP BY clauses GROUPING SETS, CUBE, ROLLUP, WITH CUBE, or WITH ROLLUP as well. If you want to query of self-referenced tables you need a clear understanding of loops and common table expressions (CTE).
Join this session for a journey through best practices to model your hierarchies and handy scripts to transform your hierarchies into useful information. We will have fun playing around with a sample database based on G. R. R. Martin’s famous “Game of Thrones”.
OOW2016: Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
This is the presentation I gave on the Oracle Open World 2016 - the topic was group functions and analytic functions.
We talked about reporting analytic functions, ranking and couple of Oracle 12c new features like top-n query syntax and pattern matching.
This presentation has the bonus slides which were not presented at the event itself, as promissed
Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
Session from ILOUG I presented in May, 2016
Even though DBAs and developers are writing SQL queries every day, it seems that advanced SQL techniques such as multi-dimension aggregation and analytic functions are still relatively remain unknown. In this session, we will explore some of the common real-world usages for analytic function, and understand how to take advantage of this great and useful tool. We will deep dive into ranking based on values and groups; understand aggregation of multiple dimensions without a group by; see how to do inter-row calculations, and much-much more…
Together we will see how we can unleash the power of analytics using Oracle 11g best practices and Oracle 12c new features.
This is a presentation from Oracle Week 2016 (Israel). This is a newer version from last year with new 12cR2 features and demo.
In the agenda:
Aggregative and advanced grouping options
Analytic functions, ranking and pagination
Hierarchical and recursive queries
Regular Expressions
Oracle 12c new rows pattern matching
XML and JSON handling with SQL
Oracle 12c (12.1 + 12.2) new features
SQL Developer Command Line tool
ASSERTIONs are a broad, general way to add constraints to your PostgreSQL database...or will be, once this patch goes in. Learn how they work and how to use them.
Hierarchies are the bread and butter of most business applications and you find them almost everywhere:
* Product Categories
* Sales Territories
* Calendar and Time
Even when there is a big need from a business perspective, the solutions in relational databases are still sort of awkward. Since Version 2008 SQL Server makes live a bit easier with data type hierarchyid. To make use of aggregations you have to master GROUP BY clauses GROUPING SETS, CUBE, ROLLUP, WITH CUBE, or WITH ROLLUP as well. If you want to query of self-referenced tables you need a clear understanding of loops and common table expressions (CTE).
Join this session for a journey through best practices to model your hierarchies and handy scripts to transform your hierarchies into useful information. We will have fun playing around with a sample database based on G. R. R. Martin’s famous “Game of Thrones”.
OOW2016: Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
This is the presentation I gave on the Oracle Open World 2016 - the topic was group functions and analytic functions.
We talked about reporting analytic functions, ranking and couple of Oracle 12c new features like top-n query syntax and pattern matching.
This presentation has the bonus slides which were not presented at the event itself, as promissed
Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
Session from ILOUG I presented in May, 2016
Even though DBAs and developers are writing SQL queries every day, it seems that advanced SQL techniques such as multi-dimension aggregation and analytic functions are still relatively remain unknown. In this session, we will explore some of the common real-world usages for analytic function, and understand how to take advantage of this great and useful tool. We will deep dive into ranking based on values and groups; understand aggregation of multiple dimensions without a group by; see how to do inter-row calculations, and much-much more…
Together we will see how we can unleash the power of analytics using Oracle 11g best practices and Oracle 12c new features.
This is a presentation from Oracle Week 2016 (Israel). This is a newer version from last year with new 12cR2 features and demo.
In the agenda:
Aggregative and advanced grouping options
Analytic functions, ranking and pagination
Hierarchical and recursive queries
Regular Expressions
Oracle 12c new rows pattern matching
XML and JSON handling with SQL
Oracle 12c (12.1 + 12.2) new features
SQL Developer Command Line tool
ASSERTIONs are a broad, general way to add constraints to your PostgreSQL database...or will be, once this patch goes in. Learn how they work and how to use them.
Techniques to optimize the pagerank algorithm usually fall in two categories. One is to try reducing the work per iteration, and the other is to try reducing the number of iterations. These goals are often at odds with one another. Skipping computation on vertices which have already converged has the potential to save iteration time. Skipping in-identical vertices, with the same in-links, helps reduce duplicate computations and thus could help reduce iteration time. Road networks often have chains which can be short-circuited before pagerank computation to improve performance. Final ranks of chain nodes can be easily calculated. This could reduce both the iteration time, and the number of iterations. If a graph has no dangling nodes, pagerank of each strongly connected component can be computed in topological order. This could help reduce the iteration time, no. of iterations, and also enable multi-iteration concurrency in pagerank computation. The combination of all of the above methods is the STICD algorithm. [sticd] For dynamic graphs, unchanged components whose ranks are unaffected can be skipped altogether.
Adjusting OpenMP PageRank : SHORT REPORT / NOTESSubhajit Sahu
For massive graphs that fit in RAM, but not in GPU memory, it is possible to take
advantage of a shared memory system with multiple CPUs, each with multiple cores, to
accelerate pagerank computation. If the NUMA architecture of the system is properly taken
into account with good vertex partitioning, the speedup can be significant. To take steps in
this direction, experiments are conducted to implement pagerank in OpenMP using two
different approaches, uniform and hybrid. The uniform approach runs all primitives required
for pagerank in OpenMP mode (with multiple threads). On the other hand, the hybrid
approach runs certain primitives in sequential mode (i.e., sumAt, multiply).
The Building Blocks of QuestDB, a Time Series Databasejavier ramirez
Talk Delivered at Valencia Codes Meetup 2024-06.
Traditionally, databases have treated timestamps just as another data type. However, when performing real-time analytics, timestamps should be first class citizens and we need rich time semantics to get the most out of our data. We also need to deal with ever growing datasets while keeping performant, which is as fun as it sounds.
It is no wonder time-series databases are now more popular than ever before. Join me in this session to learn about the internal architecture and building blocks of QuestDB, an open source time-series database designed for speed. We will also review a history of some of the changes we have gone over the past two years to deal with late and unordered data, non-blocking writes, read-replicas, or faster batch ingestion.
Techniques to optimize the pagerank algorithm usually fall in two categories. One is to try reducing the work per iteration, and the other is to try reducing the number of iterations. These goals are often at odds with one another. Skipping computation on vertices which have already converged has the potential to save iteration time. Skipping in-identical vertices, with the same in-links, helps reduce duplicate computations and thus could help reduce iteration time. Road networks often have chains which can be short-circuited before pagerank computation to improve performance. Final ranks of chain nodes can be easily calculated. This could reduce both the iteration time, and the number of iterations. If a graph has no dangling nodes, pagerank of each strongly connected component can be computed in topological order. This could help reduce the iteration time, no. of iterations, and also enable multi-iteration concurrency in pagerank computation. The combination of all of the above methods is the STICD algorithm. [sticd] For dynamic graphs, unchanged components whose ranks are unaffected can be skipped altogether.
Adjusting OpenMP PageRank : SHORT REPORT / NOTESSubhajit Sahu
For massive graphs that fit in RAM, but not in GPU memory, it is possible to take
advantage of a shared memory system with multiple CPUs, each with multiple cores, to
accelerate pagerank computation. If the NUMA architecture of the system is properly taken
into account with good vertex partitioning, the speedup can be significant. To take steps in
this direction, experiments are conducted to implement pagerank in OpenMP using two
different approaches, uniform and hybrid. The uniform approach runs all primitives required
for pagerank in OpenMP mode (with multiple threads). On the other hand, the hybrid
approach runs certain primitives in sequential mode (i.e., sumAt, multiply).
The Building Blocks of QuestDB, a Time Series Databasejavier ramirez
Talk Delivered at Valencia Codes Meetup 2024-06.
Traditionally, databases have treated timestamps just as another data type. However, when performing real-time analytics, timestamps should be first class citizens and we need rich time semantics to get the most out of our data. We also need to deal with ever growing datasets while keeping performant, which is as fun as it sounds.
It is no wonder time-series databases are now more popular than ever before. Join me in this session to learn about the internal architecture and building blocks of QuestDB, an open source time-series database designed for speed. We will also review a history of some of the changes we have gone over the past two years to deal with late and unordered data, non-blocking writes, read-replicas, or faster batch ingestion.
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Subhajit Sahu
Abstract — Levelwise PageRank is an alternative method of PageRank computation which decomposes the input graph into a directed acyclic block-graph of strongly connected components, and processes them in topological order, one level at a time. This enables calculation for ranks in a distributed fashion without per-iteration communication, unlike the standard method where all vertices are processed in each iteration. It however comes with a precondition of the absence of dead ends in the input graph. Here, the native non-distributed performance of Levelwise PageRank was compared against Monolithic PageRank on a CPU as well as a GPU. To ensure a fair comparison, Monolithic PageRank was also performed on a graph where vertices were split by components. Results indicate that Levelwise PageRank is about as fast as Monolithic PageRank on the CPU, but quite a bit slower on the GPU. Slowdown on the GPU is likely caused by a large submission of small workloads, and expected to be non-issue when the computation is performed on massive graphs.
Analysis insight about a Flyball dog competition team's performanceroli9797
Insight of my analysis about a Flyball dog competition team's last year performance. Find more: https://github.com/rolandnagy-ds/flyball_race_analysis/tree/main
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...John Andrews
SlideShare Description for "Chatty Kathy - UNC Bootcamp Final Project Presentation"
Title: Chatty Kathy: Enhancing Physical Activity Among Older Adults
Description:
Discover how Chatty Kathy, an innovative project developed at the UNC Bootcamp, aims to tackle the challenge of low physical activity among older adults. Our AI-driven solution uses peer interaction to boost and sustain exercise levels, significantly improving health outcomes. This presentation covers our problem statement, the rationale behind Chatty Kathy, synthetic data and persona creation, model performance metrics, a visual demonstration of the project, and potential future developments. Join us for an insightful Q&A session to explore the potential of this groundbreaking project.
Project Team: Jay Requarth, Jana Avery, John Andrews, Dr. Dick Davis II, Nee Buntoum, Nam Yeongjin & Mat Nicholas
Adjusting primitives for graph : SHORT REPORT / NOTESSubhajit Sahu
Graph algorithms, like PageRank Compressed Sparse Row (CSR) is an adjacency-list based graph representation that is
Multiply with different modes (map)
1. Performance of sequential execution based vs OpenMP based vector multiply.
2. Comparing various launch configs for CUDA based vector multiply.
Sum with different storage types (reduce)
1. Performance of vector element sum using float vs bfloat16 as the storage type.
Sum with different modes (reduce)
1. Performance of sequential execution based vs OpenMP based vector element sum.
2. Performance of memcpy vs in-place based CUDA based vector element sum.
3. Comparing various launch configs for CUDA based vector element sum (memcpy).
4. Comparing various launch configs for CUDA based vector element sum (in-place).
Sum with in-place strategies of CUDA mode (reduce)
1. Comparing various launch configs for CUDA based vector element sum (in-place).
Unleashing the Power of Data_ Choosing a Trusted Analytics Platform.pdfEnterprise Wired
In this guide, we'll explore the key considerations and features to look for when choosing a Trusted analytics platform that meets your organization's needs and delivers actionable intelligence you can trust.
Enhanced Enterprise Intelligence with your personal AI Data Copilot.pdfGetInData
Recently we have observed the rise of open-source Large Language Models (LLMs) that are community-driven or developed by the AI market leaders, such as Meta (Llama3), Databricks (DBRX) and Snowflake (Arctic). On the other hand, there is a growth in interest in specialized, carefully fine-tuned yet relatively small models that can efficiently assist programmers in day-to-day tasks. Finally, Retrieval-Augmented Generation (RAG) architectures have gained a lot of traction as the preferred approach for LLMs context and prompt augmentation for building conversational SQL data copilots, code copilots and chatbots.
In this presentation, we will show how we built upon these three concepts a robust Data Copilot that can help to democratize access to company data assets and boost performance of everyone working with data platforms.
Why do we need yet another (open-source ) Copilot?
How can we build one?
Architecture and evaluation
9. CREATE TABLE employee (
id SERIAL PRIMARY KEY,
first_name TEXT,
last_name TEXT
);
CREATE TABLE sales (
employee_id INTEGER NOT NULL,
sale_closed TIMESTAMPTZ NOT NULL DEFAULT NOW(),
sale_amount MONEY, /* We need to do fix this */
FOREIGN KEY(employee_id) REFERENCES employee(id)
);
Tables
Tuesday, November 18, 14
10. Data
INSERT INTO employee (first_name, last_name)
VALUES ('Larry', 'Ellison'),
('Bill', 'Gates'),
('Vladimir', 'Yulianov');
Tuesday, November 18, 14
11. Moar Data
INSERT INTO sales
SELECT
floor(random()*3)+1, /* Who */
'2014-01-01 00:00:00+00'::timestamptz +
random() * interval '1 year', /* When */
(random() * 1000)::numeric(8,2)::MONEY /* ¿Cuando? */
FROM generate_series(1,1000);
Tuesday, November 18, 14
12. How much did each sell each quarter?
Tuesday, November 18, 14
14. SELECT
employee_id,
date_trunc('Quarter', sale_closed) AS "Quarter",
SUM(sale_amount)
FROM sales
GROUP BY
employee_id,
date_trunc('Quarter', sale_closed)
ORDER BY
employee_id,
date_trunc('Quarter', sale_closed);
* I left out some formatting.
Tuesday, November 18, 14
19. (
SELECT employee_id, to_char(date_trunc('Quarter', sale_closed),
'YYYY-"Q"Q') AS "Quarter", sum(sale_amount)
FROM sales
GROUP BY employee_id, date_trunc('Quarter', sale_closed)
ORDER BY employee_id, date_trunc('Quarter', sale_closed)
)
UNION ALL
(
SELECT employee_id, to_char(date_trunc('Year', sale_closed),
'YYYY') AS "Year", sum(sale_amount)
FROM sales
GROUP BY employee_id, date_trunc('Year', sale_closed)
ORDER BY employee_id, date_trunc('Year', sale_closed)
);
Still Doable...Kinda
Tuesday, November 18, 14
29. Quick stare
SELECT
employee_id,
to_char(
date_trunc('Quarter', sale_closed),
'YYYY-"Q"Q'
) AS "Quarter",
sum(sale_amount)
FROM sales
GROUP BY CUBE (
employee_id,
date_trunc('Quarter', sale_closed)
)
ORDER BY employee_id, date_trunc('Quarter', sale_closed);
Tuesday, November 18, 14
36. SELECT
employee_id,
to_char(
date_trunc('Quarter', sale_closed),
'YYYY-"Q"Q'
) AS "Quarter",
sum(sale_amount)
FROM sales
GROUP BY ROLLUP(
employee_id,
date_trunc('Quarter', sale_closed)
)
ORDER BY
employee_id,
date_trunc('Quarter', sale_closed);
Tuesday, November 18, 14
44. SELECT
employee_id,
to_char(
date_trunc('Quarter', sale_closed),
'YYYY-"Q"Q'
) AS "Quarter",
sum(sale_amount)
FROM sales
GROUP BY GROUPING SETS(
(employee_id, date_trunc('Quarter', sale_closed)),
(employee_id)
)
ORDER BY employee_id, date_trunc('Quarter', sale_closed);
Tuesday, November 18, 14
52. HashAgg
• One pass:
• Update hash value for each row
• Output final value at the end
Tuesday, November 18, 14
53. HashAgg
• Not yet in GROUPING SETS
• Algorithmic speedup opportunity:
• O(n) vs. O(n log n)
Tuesday, November 18, 14
54. HashAgg-- :-(
• Non-hashable data types
• Aggregate functions with LOTS of state
• Ordered aggs
• Distinct aggs
• No spill-to-disk
Tuesday, November 18, 14
55. GroupAgg
• Sorts all input to the agg node to
• Detect group boundary
• Output that group
• Results before end-of-scan
Tuesday, November 18, 14
64. GroupAgg !ROLLUP
• Re-plan input to sort with >1 order
Tuesday, November 18, 14
65. GroupAgg !ROLLUP
• Re-plan input to sort with >1 order
• Plan keeps tons of global state
Tuesday, November 18, 14
66. GroupAgg !ROLLUP
• Re-plan input to sort with >1 order
• Plan keeps tons of global state
• Does NOT like to be called >1x/plan
Tuesday, November 18, 14
79. ChainAgg Nodes
• Pass input state through unchanged
• Update aggregate state
• Put rows into a chain-wide shared
tuplestore when they hit a group boundary
Tuesday, November 18, 14
80. The Last GroupAgg
• Produces its normal output until end-of-data
• Outputs the shared tuplestore
Tuesday, November 18, 14