@@ -27,7 +27,7 @@ def timed(msg, func):
27
27
)
28
28
29
29
timed (
30
- 'Find the 10,000th owner?' ,
30
+ 'Find the 10,000th owner by name ?' ,
31
31
lambda : Owner .objects ().order_by ('name' )[10000 :10001 ][0 ]
32
32
)
33
33
@@ -47,6 +47,7 @@ def find_cars_by_owner(owner_id):
47
47
48
48
49
49
def find_owners_by_car (car_id ):
50
+ print (car_id )
50
51
owners = Owner .objects (car_ids = car_id )
51
52
return list (owners )
52
53
@@ -70,18 +71,19 @@ def find_owners_by_car(car_id):
70
71
71
72
timed (
72
73
'Cars with expensive service and spark plugs?' ,
73
- lambda : Car .objects (service_history__price__gt = 16800 , service_history__description = 'Spark plugs' ).count ()
74
+ lambda : Car .objects (service_history__price__gt = 16800 ,
75
+ service_history__description = 'Spark plugs' ).count ()
74
76
)
75
77
76
78
timed (
77
79
'Load cars with expensive service and spark plugs?' ,
78
- lambda : list (Car .objects (service_history__price__gt = 16800 , service_history__description = 'Spark plugs' ) )
80
+ lambda : list (Car .objects (service_history__price__gt = 15000 )[: 100 ] )
79
81
)
80
82
81
83
timed (
82
84
'Load car name and ids with expensive service and spark plugs?' ,
83
- lambda : list (Car .objects (service_history__price__gt = 16800 , service_history__description = 'Spark plugs' )
84
- .only ('make' , 'model' , 'id' ))
85
+ lambda : list (Car .objects (service_history__price__gt = 15000 )
86
+ .only ('make' , 'model' , 'id' )[: 100 ] )
85
87
)
86
88
87
89
timed (
0 commit comments