1π
β
Iβd imagine its the first one β but this isnβt a fair contest.
Your second pure sql statement also has to do a grouping and an ordering which your first does not so the first is just a WHERE
.
The reason it could be the second is because the first gets *
rather than just the 3 items you need so you may be better off with the following:
super(DahlBookManager, self).get_queryset().filter(author='Roald Dahl').values('id',
'question',
'poll_date')
Now this may just be my opinion but for most queries you do in django you should use django and avoid raw queries. It will help you if you ever decide to use a different database schema and potentially create more efficient queries.
π€Sayse
Source:stackexchange.com