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!

Link to comment
Share on other sites

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?"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.