L
L
leonid42442015-12-15 20:06:32
PHP
leonid4244, 2015-12-15 20:06:32

PhP Text file or mysql?

Hello. Need advice from experts!
There is a task that you need to check with a php script a large amount of text keys from 500k - 3kk.
Which is better to use for fast action, plain text file or mysql.
It is necessary to constantly compare whether the key is present in an existing one or not. You will also need to sort through all the keys among themselves, for example, key 1 was taken from 3k keys, so until the key 2999k was taken from 3k.
Explained as best I could, if it's not clear, I'm sorry.
To summarize the question, what is faster to constantly pull mysql or a text file, even if it is huge, for example 1g

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
v- death, 2015-12-15
@leonid4244

mysql of course

R
romy4, 2015-12-15
@romy4

1 gram of a file (with one request) will not pull the muscle without foreplay, but, of course, this is an order of magnitude faster than pushing a speech from PHP

I
Ivanq, 2015-12-15
@Ivanq

Naturally MySQL.
Here you are reading the file. A pointer is translated, written to a variable, fgets/fread heaps are called. There will be no dancing with a tambourine in MySQL. More precisely, they will, but less by an order of magnitude.

A
Andrey, 2015-12-15
@VladimirAndreev

How much memory do you have?
if you can load the entire file into memory, then mysql didn’t give up ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question