Monday, January 1, 2024

Redis Search and SQL Command Comparison

Summary

This post covers comparisons of various data search scenarios of equivalent SQL and Redis Search commands.  The Chinook data set is deployed in Oracle Enterprise.  The Oracle Enterprise data is then continuously populated into Redis JSON objects using Redis Data Integration (RDI).


Architecture

This entire architecture is deployed in Docker containers.


Sample Scenarios


Scenario  - Which countries have the most Invoices?

SQL


Redis Search


Scenario  - Which artists have written the most Rock music?

This particular query touches 4 different tables in relational db tables.  There are 2 approaches to this in Oracle:
  • Ad hoc query that implements the necessary joins
  • Materialized View that implements the same join query but is updated continuously.

SQL - Query


SQL - Materialized View

Below is the equivalent Materialized View.  The ALTER commands set this view up to be tracked by Debezium and ultimately replicated in Redis Enterprise.

Redis Search - Materialized View

The Oracle Materialized View is treated the same as any other table by Debezium and is thus populated into Redis via RDI.

Redis Search - Triggers & functions

An alternate approach to the materialized view is to perform the necessary joins in a Redis Function.  This a Gear 2.0 feature where a function can be written in Javascript and executed server-side in Redis.  Snippet below of that function.


Source


Copyright ©1993-2024 Joey E Whelan, All rights reserved.