T
T
Taras Parashchuk2020-12-02 16:54:47
Laravel
Taras Parashchuk, 2020-12-02 16:54:47

How to organize the import of bulk files and the work of other users in Laravel?

I have a price list for 500,000 lines imported into the database, the database is busy for about 10 minutes.
When the price list is loaded, the modal form with the file selection is hidden and the user can do what he wants.
Besides him, there are other users.
How to properly organize the work so that they do not edit records in the table when updates are loaded into it.
The same and other users can perform similar actions.
Can I make a global variable in which to display the state of the database, and check it every time it is accessed in the database?
Or make a record in a separate table in which to display the state of the database and check it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-12-02
@taras1978

https://dev.mysql.com/doc/refman/8.0/en/lock-table...
if you set a write lock, then no one except the existing connection can do anything with the table.
If you want reading to be possible, then you need to create a service table, which is locked at the beginning of any update (it turns out like a mutex), and the main table is not locked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question