Jump to content

Execution Time: Finding a File vs. Finding a Row in MySQL


zekova

Recommended Posts

What if I have 100,000 rows in a MySQL table, and a 100,000 files in a directory, each file representing a row in the MySQL table.... 

 

Which, in your experience, is faster to find? A file called 123456789.csv or a record where id='123456789'?

 

Any input is appreciated, thanks!

Table with over 180,000 records.

mysql> SELECT COUNT(*) FROM votes;
+----------+
| COUNT(*) |
+----------+
|   182685 |
+----------+

Find 100,000th

mysql> SELECT * FROM test.votes
    -> WHERE id = 100000;
+--------+-------+------+
| id     | votes | type |
+--------+-------+------+
| 100000 |   647 |    7 |
+--------+-------+------+
1 row in set (0.00 sec)

Less than 1/100th of a second, so the question is "how long to find and read your file?"

So it started as

find one record vs find one file

 

Now its

Find 1000's of records vs find one file

 

If you are going to keep moving the goalposts perhaps you should experiment and do your own benchmark tests

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.