Opened 6 years ago
Closed 6 years ago
#30143 closed Bug (invalid)
Django query abrupt behaviour
Reported by: | Shashank Parekh | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
class Model: a = models.CharField(max_length=100) b = models.CharField(max_length=100) c = models.DateTimeField(max_length=100) query1 = Models.objects.filter(Q(a__in=['1']) | Q(b__in=['2'])).filter(**{'c__gte': timezone.datetime(2019,1,1), 'c__lte': timezone.datetime(2019,2,1)}).order_by('-c') query2 = Models.objects.filter(Q(a__in=['1']) | Q(b__in=['2'])).filter(**{'c__gte': timezone.datetime(2019,1,1), 'c__lte': timezone.datetime(2019,2,1)})
query2 is executed perfectly but query1 is timing out.
I did explain on query1 and ran the query(on explain()
output) on MySQL directly and it worked absolutely fine.
query1 worked fine in django1.8 but not in django2.1.
Although, If I use query1.iterator()
it is working.
Mysql version = 5.6.39
No of rows in table = 5M
Change History (3)
comment:1 by , 6 years ago
Description: | modified (diff) |
---|
comment:2 by , 6 years ago
Description: | modified (diff) |
---|
comment:3 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.