A
A
Alexander Sorochinsky2015-10-27 20:35:32
MySQL
Alexander Sorochinsky, 2015-10-27 20:35:32

MySql index vs Javascript V8 object?

I do caching in Node.js code, that is, I save data from the MySql database into javascript objects for a while until nothing changes. There was usually not much data - dozens of lines. But now there was a task to do the same with a million lines.
The question arose whether such caching would worsen the speed of work if you select by key in the javascript object instead of a similar query in the database?
SELECT * FROM map WHERE location = '12345'; (field location under btree index, table type MyISAM, table has a million records)
vs
var record = map['12345']; (V8 under Node.js, object has a million values)
Is there a difference between fetching one element and a couple of thousand elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evnuh, 2015-10-27
@evnuh

Why change the awl for soap? Try to put a hash index in the database and warm it up, then the data will be in memory and the access speed is O (1), that is, no worse than your Node.JS and radish.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question