Skip to content

Conversation

vincent-pochet
Copy link
Collaborator

@vincent-pochet vincent-pochet commented Aug 12, 2025

Context

This PR intend to improve the performance when creating an event using the POST /api/v1/events.

The event model has a uniqueness validation on the transaction_id field. Rails is performing a database query to validate this uniquess and it appears to be slow...

Description

Since we already have a unique index in place in the database, this PR removes the validation and adds the logic to catch the Postgres error.
Some load testing have been conducted with this approach and it cuts the response time by a large factor, increasing the number of events/sec that could be received by the API

@vincent-pochet vincent-pochet force-pushed the misc-remove-event-index branch from 95b5511 to 194a13c Compare August 12, 2025 15:28
@vincent-pochet vincent-pochet marked this pull request as ready for review August 12, 2025 15:35
@vincent-pochet vincent-pochet merged commit f58345e into main Aug 12, 2025
14 checks passed
@vincent-pochet vincent-pochet deleted the misc-remove-event-index branch August 12, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants