A QuerySet is a lazy object. When you assign contact_list = Contacts.objects.all() , Django will NOT get into the database. Until you call methods like count() , filter() , first() , ... or contact_list[1:5] , Django will actually retrieve data from the database. The SQL statements that Django generate will correlate with each method, and this SQL data will be sent to the database.
For example: contact_list[1:5] generate an SQL statement have LIMIT and OFFSET clauses.
In a Paginator the QuerySet class is passed to its constructor
paginator = Paginator(contact_list, 25)
When you call paginator.page(page) , the statement is called:
return self._get_page(self.object_list[bottom:top], number, self)
source share