On 10/08/2020 17:24, Ashkar Dev wrote:
Hi,
for web application is it needed to use UUID or auto-increment?
1- if two user inserts row at the same time, does it work?
2- dose the database give the same id for both users or execute one of
them first? ( I mean ID conflict not happens?)
(using PostgreSQL database with PHP)
Ashkar ... this is not really a PHP problem, but rather one to ask on
the PostgreSQL list ... That some database engines did have problems
with concurrent operations in the early days is a fact, but today the
use of auto-increment will resolve any problem with multiple users
populating the one table.
Where it does become a PHP problem is a case of just how you access the
auto-increment value if you need it. It may be worth asking for a unique
id prior to populating the rest of the data, rather than building
everything up and the submitting it. Some of my systems add a blank
record when 'add' is started and it will be marked with a 'deleted' if
the record is not completed ... part of tracking the work staff are
doing that is non-productive.
All this assumes you are using the one database and so all users are
working against that. UUID comes into it's own where you can't access
that database and need to store data locally until it can be uploaded,
but in that case a site id used with a local auto-increment may be
adequate which can be replaced with a global_id when it has been submitted.
--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.uk/wiki/Contact
L.S.Caine Electronic Services - https://lsces.uk
Model Engineers Digital Workshop - https://medw.uk
Rainbow Digital Media - https://rainbowdigitalmedia.uk