General
From Oracle to DuckDB and Vispeahen: A BI Modernization Story
|
Serdar Güler
A real data engineering story with Oracle, Apache Arrow, DuckDB, MinIO, PostgreSQL and Vispeahen.

From Oracle to DuckDB and Vispeahen: A BI Modernization Story
Is the Problem in the Dashboard or in the Data?
Enterprise data warehouses grow over time. New tables are added, the scope of reports widens, business rules get more complex. Architectures that were sufficient at the start can struggle to meet needs that change over the years.
That was exactly the situation we ran into at one of our customers.
There was a comprehensive, long-developed data warehouse running on the Oracle ecosystem. Some tables were quite large, and many JOIN operations were performed while building reports.
This led to serious performance problems, especially on certain analytical screens.
Moreover, the problem was not limited to the query performance of the data warehouse.
The organization had moved from Oracle BI to Oracle Analytics. However, the expected user experience had not been fully achieved, especially in map-based analyses.
So we had two separate problems: the performance of the analytical queries, and how the results of those queries were presented to the user.
Instead of redesigning the existing data warehouse from scratch, we decided to build a new data processing and presentation architecture dedicated to analytical needs.

The problem: dashboard or data?
First Decision: How Do We Get Data Out of Oracle?
Our goal was to create an independent analytics layer where we could process the source systems on the existing Oracle more efficiently.
For this, we designed an ODS layer on MinIO where data would be stored in Apache Parquet format.
But how we moved the large tables into this environment mattered.
We did not want to export the data in full first and then convert it to Parquet with a separate process. That approach could create unnecessary disk I/O, extra storage and resource consumption.
Instead, we developed a transfer method that combines Oracle query cursors with Apache Arrow.
We passed the data read from Oracle to DuckDB through Arrow's columnar in-memory structures and produced the Parquet files directly.
This way we could fill the ODS layer without creating large temporary data files in between.
The resulting data transfer pipeline both ran fast and used resources efficiently.
Here, Arrow, DuckDB and Parquet took on three complementary roles: Arrow provided efficient in-memory data transfer, DuckDB provided data processing, and Parquet provided persistent storage of the analytical data.

From Oracle to Parquet with Arrow and DuckDB
Second Decision: Using DuckDB as an ETL Engine
Building the ODS layer was only the beginning.
Our next goal was to produce datamarts suitable for analytical reporting from this raw data.
For this, we kept the layered approach of the traditional data warehouse architecture.
We developed Apache Airflow DAGs that build the Staging, DWH and Datamart layers in order from the ODS data.
However, at the center of these processes was DuckDB instead of a conventional database server.
With DuckDB we read the Parquet files and built the transformations, JOIN operations and the required data models. We wrote the output of every stage back to MinIO, again in Parquet format.
This way, we separated persistent storage of the data from the compute processes.
While DuckDB acts as an analytical engine that processes data when needed, MinIO became the persistent storage for our data layers.

ETL with DuckDB: Staging, DWH, Datamart
The Fastest Query Is Not Always the Best Query
One important issue we faced while processing large datasets was memory consumption.
Especially in large JOIN and aggregation operations, we needed to manage DuckDB's resource usage carefully.
For this reason, we made fine-grained adjustments to resource management in DuckDB and made use of the spill-to-disk mechanism.
This had a price: some operations finished a bit more slowly.
But we were able to make memory consumption more controlled.
What mattered to us was not getting a single query done in the shortest possible time. It was more important that the entire data processing pipeline ran reliably and sustainably with the available resources.
We saw once again in this project that performance optimization sometimes means more balanced resource consumption instead of more speed.

Speed vs. balanced resource usage
Third Decision: Reading Less Data Before Reading Data Faster
While preparing the datamarts in Parquet format, we also designed the physical data organization according to query needs.
We split the Parquet files on MinIO into different folders using the Hive Partitioning approach.
We did not use the same partition strategy for every datamart. We chose different partition columns by taking the data structure and the expected query behavior into account. We mostly preferred time-based partitioning.
This allowed us to benefit from DuckDB's partition pruning capability in queries running with suitable filters.
For example, for a user who only wanted to query a specific period, there was no need to read all the Parquet files belonging to the other periods.
This approach contributed significantly to the query performance of large datamarts.
Our core principle here was simple: instead of trying to read unnecessary data faster, read it as little as possible, ideally not at all.

Hive Partitioning and partition pruning
Fourth Decision: Why PostgreSQL Instead of Connecting DuckDB Directly?
At this point we had datamarts prepared in Parquet format sitting on MinIO.
The shortest way to connect them to Vispeahen was to use a DuckDB connection. Vispeahen already supported DuckDB data sources.
But our customer had another need.
The technical teams wanted to query the data behind the reports directly with their own SQL tools. This was especially important in data validation processes.
So we chose a different path.
We installed the pg_duckdb extension on PostgreSQL.
This gave us a structure where we could connect through PostgreSQL and benefit from DuckDB's analytical query capabilities.
Our datamarts were still sitting on MinIO in Parquet format.
PostgreSQL became our SQL layer providing access to this analytical data.
We connected Vispeahen through PostgreSQL as well.
At first glance, adding an extra PostgreSQL server to this architecture may look unnecessary. But for us, it was important that data access was not limited to the BI platform alone.
Users being able to query data with the tools they know, and to validate independently of the business intelligence screens, was an important part of the solution.

SQL access with PostgreSQL and pg_duckdb
Final Step: Turning Fast Data into Useful Analytics
We had built the data processing and query infrastructure. But the real success of the project would be measured by how this was reflected in the end user's experience.
We focused on two areas in particular: pivot tables and map-based analyses.
Pivot Tables: Managing Large Result Sets
Vispeahen's pivot table component is built on AG Grid.
Thanks to AG Grid's efficient table rendering mechanisms, we could display large result sets smoothly.
Here, the optimizations we made in the data layer and the performance of the visualization layer complemented each other.
Datamarts prepared for analytical needs and Parquet-based querying reduced data preparation costs, while AG Grid provided the interface where users interact with the results.
This way, in the pivot table experience we focused not only on the SQL performance in the background, but also on how query results are presented to the user.
Maps: From Visualization to Interactive Analysis
For map-based analyses, we used Vispeahen's deck.gl-based visualization infrastructure.
deck.gl's GPU-accelerated rendering architecture allowed geographic data to be visualized effectively.
But what the customer especially liked was not only that the maps ran fast.
Being able to analyze multiple geographic data layers together on the same map made an important difference.
Thanks to multi-layer analyses, different datasets could be evaluated in the same geographic context.
In addition, we connected the maps to other dashboard components with Vispeahen's interaction engine.
Users could influence the map analyses through different charts and filters, and experience a connected analysis across visualizations.
Being able to prepare customizable tooltips and info cards for objects on the map was also one of the features users particularly liked.
This way, the map stopped being just a visual showing location data. It became an interactive analysis tool working together with other analytical components.
Conclusion: Performance Is Not Just Query Time
When we started this project, we faced an Oracle data warehouse that had grown over the years, complex queries, and analytical screens that users were not satisfied enough with.
We did not look for the solution only in setting up a more powerful server or replacing the BI tool.
Instead, we approached the data architecture again across different layers.
We made data transfer from Oracle efficient with Arrow and DuckDB. We built a layered analytical data infrastructure on MinIO and Parquet. We orchestrated the transformation processes with Airflow. We optimized DuckDB's resource usage and reduced the amount of data read in queries with Hive Partitioning.
With the combination of PostgreSQL and pg_duckdb, we offered the customer direct SQL access.
Finally, using AG Grid and deck.gl on Vispeahen, we brought pivot tables and interactive geographic analyses to users.
In the resulting solution, performance, resource usage, data accessibility and user experience were not independent topics. All of them were parts of the same architecture.
The most important lesson we took from this project was this: in business intelligence, real performance comes not just from making queries faster, but from designing correctly the entire path the data follows from the source to the user.






