what is the limit of an id, in database?

5

I have a database in Postgres that is already running a week and the amount of data entered is 3788, this number reflects the id of my table, plus I am informed that this amount is similinar per week.

I create the id in the following way:

id integer NOT NULL DEFAULT nextval('memoria_id_seq'),

So, what worries me and I wanted to know is:

  

What is the limit of this id?
  Should I change the database to extend this id?
  Or maybe I just have to change the type of data? What would this type of data be?

    
asked by Shassain 01.04.2018 в 00:54
source

1 answer

4

The field being type INT ; It has the following characteristics

  

int (integer): Range is -2,000,000,000 to 2,000,000,000 more or less.

Although perfectly you can occupy BIGINT

  

bigint (big integer): calculating would be approx. 2^64

what should occupy you in any manager is the quality and logic of your queries to extract data

Below you can see the tables with the data types in both PostgreSQL and MySQL to have a clear idea

Look at this table and check the source (PostgreSQL)

Data types

What you should check as your system grows, are: bandwidth available to the web server, RAM, quality of SQL queries, etc etc

In the following table I show you the lengths of the data for MySQL so you can check that it does not depend on the database manager

    
answered by 01.04.2018 / 00:57
source