Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GUID for a primary key?
Message
De
27/07/2021 21:15:50
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
 
 
À
27/07/2021 05:56:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01681922
Message ID:
01681948
Vues:
80
>>>To me it looks like a no brainer. When creating a primary key for a table I use a guid.
>
>We used SQL Server autoinc/identity fields starting in 1996. Problem is that unless you knew back then to seed the Identity at -2 billion, INT tops out at 2 billion which sounds like a lot unless you're deleting and re-inserting rows frequently which can chew through the increment very quickly. Path forward possibly involving bigint though that will involve some FK issues and VFP doesn't have that field type. GUID obviously avoids all this, at the cost of bulk and possibly less efficient indexing if you can get away with INT identity.

>> What exactly is the reason or use case for (delete all then insert) IAC ? Avoid audit tables ?

If interfaces send full data afresh every time, then it's traditional to delete and re-insert the 1-M data. I suppose a more complicated row reuse mechanism could be attempted, but KISS advises otherwise.

>>For me to find / follow change order, edt_timstp plus edt_counter on records is enough

We encountered a gnarly timestamp issue with Oracle transactions taking many seconds; basically rows only appeared in the table after a filter on the timestamp field should have captured them. I'm a great fan of autoincrement PK so any value greater than the last processed, ought to be new no matter what.

>> Currency is a 8 Byte integer. As I think there is only compare, not update in vfp, is Binary good enough ?

Short answer = don't know. Before Fox got the integer field type, we had our own 4-byte binary equivalent and I suppose a 5-byte equivalent would take care of the 2B limit- except that the database's own autoincrement is too good to give up IMHO.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform