There is a site, where images are not organized into month- and year-based folders. There are more than 20 000 of images in one folder (uploads) now. When I try accessing the folder via a file browser, it notably freezes.

So, my question is: could this affect site performance?


Short Answer: No

A different question is: Will uploading a large number of files in WordPress affect performance? The answer to this: Most likely not.


  • WordPress uses the DB to get a list of uploaded files (almost no difference for many files)
  • FTP uses the filesystem (slower for many files)


WordPress does not list the directory contents of the uploads folder, so you can dump any amount of files there without WordPress even noticing it.

When you upload a file via WordPress a new DB entry is made to your wp_posts table. WordPress only knows about the media files by looking into wp_posts, so uploading a ton of files will add more lines to that table and therefore makes SQL queries a bit slower. Though honestly the amount (20.000 entries in DB) will not have a big impact on most hosting environments. Also WordPress has optimizations at every end to make it run fast (e.g. it caches SQL results and limits the number of queried rows)

However, as you noticed: When accessing the folder via FTP it freezes. This is caused by FTP requesting a list of all files the folder, and the server takes a while to answer with a list of 20.000 filesnames. But this performance issue is not affecting WordPress itself.


Well, does it affect site performance? If you are not noticing in actual site operation then likely not, at least at your number of files.

There are performance considerations for large amounts of files. Budget hosts (which know what they are doing) typically even put in explicit limits on filesystem usage.

However in WordPress operation you are not hitting filesystem that much. The way attachments work is that paths to file (and its sizes in case of images) are stored in database. In that way there is rarely need to access (or worse - scan) filesystem just to know where the files is and point to it.

I hadn't encountered this directly, but to my knowledge the issues with large (like millions of files large) amounts of attachments in WordPress start to exhibit on database querying level before filesystem. But then I would guess people with millions of files would already have server/filesystem setup capable of handling it.


Yes. Too many files or directories in one directory can impact site performance badly, though 20,000 isn't too bad, your really start to see problems over 100,000+

Make sure in your WordPress settings you've set media to distribute uploads into date-named folders (such as 2019/01/), but be aware WordPress appears to use file creation date to determine which folder it puts a file in, so you may need to override that if your users are uploading a lot of files created in a single date.

See https://hetzner.co.za/help-centre/website/inode-usage/ for more

Your Answer

