I read filter and exclude from django documentation but I want to know that if I will use following code:
Entry.objects.filter(
... headline__startswith='What'
... ).exclude(
... pub_date__gte=datetime.now()
... ).filter(
... pub_date__gte=datetime(2005, 1, 1)
... )
then , will it be resulted in 1 query or 4 queries? Will it first query and get all the objects and then will filter and exclude after fetching all records from mysql/db or it will all be done on mysql/db level. Because if it will not be done on db level then it can result in performance problem. thats why I want to know that will filter and exclude work on app level or db level?