Limits and datatype for connection_id()

  • Filter
  • Time
  • Show
Clear All
new posts

  • Limits and datatype for connection_id()


    we use connection_id() return value to fill some fields in a mysql-myisam database.

    I have spent a lot of time researching about the returned value, but I have not found any interesting information, so I'm asking this blog which I follow from one year now.

    My questions are:

    - select connection_id() returns an integer value: what are the limits? How should a declare the field to store it?

    - what will happen when the limits are reached? Yes, it is possible; we are managing millions of connections per day on a single database...

    - is it there any other better parameter available in a query, to ensure that two concurrent users will have returned different values?

    Many thanks in advance.

  • #2
    Use INT UNSIGNED NOT NULL. I am pretty sure it's not a BIGINT, but I can't remember why I believe that.