reading from MySQL is faster or reading from a fil

2020-04-07 18:36发布

HI

I got a doubt I have seen reading mysql data is slower in case of large tables...I have done lots of optimization but cant get through..

what I am thinking is will it give a better speed if I store data in a piece of file??

off course each data will be a separate file. so millions of data = millions of file. I agree it will consume the disk space... but what about reading process?? is it faster??

I am using PHP to read file...

标签: php mysql file
7条回答
【Aperson】
2楼-- · 2020-04-07 19:25

It depends on a lot of factors, not least of which is what kind of file system you're using. MySQL uses files for storage anyway, so read speed isn't the issue -- the biggest factor will be how fast MySQL can find your data, compared to how fast it can be looked up in your filesystem.

Generally, though, MySQL is quite good about finding data quickly -- after all, that's its purpose in life. So unless you have a really good reason why the FS should be much faster, stick with the DB and check your indexes and such.

查看更多
登录 后发表回答