I
I
Ivan Ivanov2017-09-24 17:09:38
MySQL
Ivan Ivanov, 2017-09-24 17:09:38

What is the best way to make a database?

Good afternoon.
I am developing a CRM system that will exchange data about companies, contacts, invoices and other documents with 1C in XML format.
Each record in the database has a global identifier (GUID) which is the primary key of the table and is output in the exchange XML file. How justified and safe is the use of a GUID as a primary key and passing it in the exchange file, or is it better to make an auto-increment identifier and use it only for communication within the database, and indicate the GUID in a separate table field and use it only for data exchange?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kinash, 2017-09-26
@Yausi

The answer lies on the surface and rests on the nature of the connection between the site database and 1C, which you kept silent about. What comes first - the site or 1s?
If the primary database is 1C, and the site is just its frontend, then storing an additional auto-increment key is obviously redundant: it slightly, but increases the size of the database; it complicates and slows down site maintenance (especially due to joins in requests - so if you have a GUID, you will need to make an extra query to the product table to get the ID and only then can you request prices and discounts).
If there is a primary site where work is established with a wider range of counterparties and potential customers (leads) than is necessary for 1C, where the range of goods and services far exceeds the amount of data that needs to be uploaded to the accounting subsystem for reporting, then the need to have local ID system, and from 1C pull up the GUIDs of only the necessary positions and store them for synchronization purposes, but not at all for cross-references.

F
Fortop, 2017-09-24
@Fortop

How justified and safe is the use of a GUID as a primary key and passing it in the exchange file

If you do not plan to scale your CRM to dozens of servers, then the GUID will be redundant.
As long as the application is running from a single DB, an autoincrement or sequence generator within a DB server is much more practical

K
Konstantin Nagibovich, 2017-09-25
@nki

Understand how data is stored in 1C. All elements of directories and documents already have their own GUID. So use it for exchanges.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question