I want to allow my users to create blacklists of content sources (users/categories/words/?). They shouldn't be able to see any content from these sources.
For example: If user A blacklisted user B and then user B uploaded a picture, then user A request to see the gallery he won't see picture from B, but he'll be able to see pictures from user C, D, ...
The problem occurs when one user built a big blacklist (e.g. 100 sources). Then the SQL queries will be really long and complex ("...and author != 'B' and category != 'C'...") what will eventually kill my server.
What are the other ways to handle this problem?
It sounds to me like you're using dynamic SQL to build this query. You should have the blacklist stored in a table related by UserId, then you can write a stored procedure that uses NOT IN
or NOT EXISTS
to build the final resultset.