Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Index management best practices for Redis Query Engine

Introduction to managing Redis Query Engine indexes

The Redis Query Engine (RQE) is a powerful tool for executing complex search and query operations on structured, semi-structured, and unstructured data. Indexes are the backbone of this functionality, enabling fast and efficient data retrieval. Proper management of these indexes is essential for optimal performance, scalability, and resource utilization.

This guide outlines best practices for managing RQE indexes throughout their lifecycle. It provides recommendations on:

Why index management matters

Indexes directly impact query speed and resource consumption. Poorly managed indexes can lead to increased memory usage, slower query times, and challenges in maintaining data consistency. By following the strategies outlined in this guide, you can:

Plan your indexes strategically

Planning your indexes strategically requires understanding your application’s query patterns and tailoring indexes to match. Begin by identifying the types of searches your application performs—such as full-text search, range queries, or geospatial lookups—and the fields involved. Categorize fields based on their purpose: searchable fields (e.g., TEXT for full-text searches), filterable fields (e.g., TAG for exact match searches), and sortable fields (e.g., NUMERIC for range queries or sorting). Match field types to their intended use and avoid indexing fields that are rarely queried to conserve resources. Here's the list of index types:

See these pages for discussions and examples on how best to use these index types.

Next, simulate queries on a sample dataset to identify potential bottlenecks. Use tools like FT.PROFILE to analyze query execution and refine your schema if needed. For example, assign weights to TEXT fields for prioritizing results or use the PREFIX option of FT.CREATE to limit indexing to specific key patterns. Note that you can use multiple PREFIX clauses when you create an index (see below) After creating the index, validate its performance with real queries and monitor usage with the available tools:

Avoid over-indexing. Indexing every field increases memory usage and can slow down updates. Only index the fields that are essential for your planned queries.

Index creation

Index aliasing

Index aliases act as abstracted names for the underlying indexes, enabling applications to reference the alias instead of the actual index name. This approach simplifies schema updates and index management.

There are several use cases for index aliasing, including:

Best practices for aliasing:

Tools for managing aliases:

Monitoring and troubleshooting aliases:

Monitor index population

Monitoring index performance

Index maintenance

FT.ALTER vs. aliasing

Use FT.ALTER when you need to add new fields to an existing index without rebuilding it, minimizing downtime and resource usage. However, FT.ALTER cannot remove or modify existing fields, limiting its flexibility.

Use index aliasing when making schema changes that require reindexing, such as modifying field types or removing fields. In this case, create a new index with the updated schema, populate it, and then use FT.ALIASUPDATE to seamlessly switch queries to the new index without disrupting application functionality.

Scaling and high availability

Versioning and testing

Cleaning up

Documentation and automation

RATE THIS PAGE
Back to top ↑