This is caused by there being too many files of a particular content type trying to be imported into a list template.

Every time a component with a filter is loaded, in the preview or body, the database has to return the sum total of all items that could be in a related item select list. The issue may not be one specific list, because if there are 5 list templates on a page, and they all load all images for example,  the query and results are loaded 5 times. Organizing the content types into sub-folders and reducing the amount being pulled into each list, will reduce the impact on the system and will prevent the error from popping up.  Essentially the issue is too many files are trying to be listed, and this is overloading the system and generating the error as a result.