ID (auto-increment) too high can be harmful?

3

I have a table that has a very high turnover of information, that is, many records come in and many come out as well. With this the ID (auto-increment) is much higher than the data value in the table.

For example, the table has 530 records and the (auto-increment) ID is at 1250, and those numbers tend to increase relatively quickly.

I wonder if this can cause some slowness or it can be bad in some way for my database and my application. If it causes any problems, what can I do to improve this?

Note: I do not know if it changes into something, but the IDs of this table are foreign keys in other tables.

    
asked by anonymous 19.01.2016 / 18:30

1 answer

4

In postgres the auto-increment field is called a sequence, an id with high number does not cause slowness in a query, the problem that may happen is that this field (int maybe) reaches its limit quickly in this case it would be necessary to switch a larger capacity type such as bigint.

A curious fact that happens a while back was the youtube viewer bursting after this, a negative number of views appeared in psy's video.

Excerpt taken from How 'Gangnam Style' popped YouTube counter

  

The YouTube counter has so far used a 32-bit marker, which represents the data in the computational architecture.

     

This means that the maximum number of hits that could be logged was 2,147,483,647.

    
19.01.2016 / 18:42