How to save and synchronize a large list of strings

I have a large database table in SQLExpress for Windows with a specific "code" field of interest.

I have an Apache web server with MySQL on Linux. The Linux box web application needs access to a list of all the codes. The only thing that will use this list is checking for the presence of the given code.

If a Linux server is called onto a Windows server, this is impractical because the Windows server is connected to the Internet on a NAT network and may not always be available. I installed it so that the Windows server moves the code list to the web server using a simple HTTP POST request. However, at the moment I have not implemented the storage of codes in the Linux box.

Should I store them in a MySQL table with a single "code" field? Then I get O (1) quick indexed queries, however I think that synchronization will be a problem - given the updated list of codes pressed from the Windows window, how would it be optimal to synchronize the list with the database? TRUNCATE and then INSERT?

Should I store them in a flat file? Then I have O (n) search time, not O (1). Also, the extra excessive overhead, too, since I will be processing the file in Ruby. However, synchronization is simple - just replace the file.

UPDATE

Another approach: Violate the file system : Given the code, say, "ABCDEF", create a path similar to "A / AB / ABC / ABCDEF" and tap the file there. I think I like this approach the most. It is a bad idea?

+3
source share
1 answer

First, if your web application is persistent, just add the codes to the current persistence store. (Easier)

But it really depends on the size of your code list. Since you can use HTTP POST for codes, it is not like large gigabytes are stored in a flat file.

, MB ( ), MySQL. , , 1MB , , .

, : .

+1

Source: https://habr.com/ru/post/1740238/


All Articles