mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-13 03:27:05 +00:00

* Initial plan * Initial analysis: identify ordering issue in alert events Co-authored-by: harshach <38649+harshach@users.noreply.github.com> * Fix PostgreSQL query ordering in listAllEventsWithStatuses Co-authored-by: harshach <38649+harshach@users.noreply.github.com> * Add comprehensive test coverage and performance indexes for event ordering - Add CollectionDAOEventOrderingTest with 4 comprehensive test methods - Test chronological ordering, pagination, edge cases, and cross-database consistency - Add critical timestamp indexes for consumers_dlq and successful_sent_change_events tables - Indexes prevent table scans on ORDER BY timestamp DESC queries - Migration 1.9.1 includes both MySQL and PostgreSQL index definitions Addresses performance concerns and test coverage gaps identified in PR review. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: harshach <38649+harshach@users.noreply.github.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Sriharsha Chintalapani <harsha@getcollate.io> Co-authored-by: Teddy <teddy.crepineau@gmail.com>
14 lines
949 B
SQL
14 lines
949 B
SQL
-- Add timestamp indexes for improved performance of event ordering queries
|
|
-- These indexes significantly improve performance of ORDER BY timestamp DESC queries
|
|
-- used in listAllEventsWithStatuses method for alert event retrieval
|
|
|
|
-- Add descending timestamp index for consumers_dlq table
|
|
-- This table stores failed event subscription events
|
|
CREATE INDEX IF NOT EXISTS idx_consumers_dlq_timestamp_desc ON consumers_dlq (timestamp DESC);
|
|
|
|
-- Add descending timestamp index for successful_sent_change_events table
|
|
-- This table stores successfully sent event subscription events
|
|
CREATE INDEX IF NOT EXISTS idx_successful_events_timestamp_desc ON successful_sent_change_events (timestamp DESC);
|
|
|
|
-- Add composite index for better performance when filtering by subscription ID and ordering by timestamp
|
|
CREATE INDEX IF NOT EXISTS idx_successful_events_subscription_timestamp ON successful_sent_change_events (event_subscription_id, timestamp DESC); |