dsapandora
dsapandora

Reputation: 104

Active Record with postgres sometimes skip index

Working with Active Record in postgres in a rails application, hosted in heroku I start to notice that sometimes the index of my database are been skipped. For example: product id 1000 1001 1003 <---- Missing the 1002

This is not happen all the time, and I am trying to figure out what is the issue. I check database logs, the server logs and also I call my clients and they said that they have no issue. But I need to know why this skipping scenarios is happening.

rails', '3.2.17' activerecord (3.2.17) pg (0.14.1) pg_search (0.7.0)

I have my guess: this can be heroku issue, with Async Excect, but I have no idea.

Upvotes: 2

Views: 561

Answers (1)

Andy Gauge
Andy Gauge

Reputation: 1428

Your transaction rolled back due to some invalid data. Could be google spiders, or less savory robots trying to penetrate the site.

Here's a stack overflow answer: How to reset Autoincremented Id when rollback occurs in sql

Autoincrement IDs should not be contiguous in a production environment.

Upvotes: 1

Related Questions