P
P
pr0kazn1k2017-06-05 11:06:56
Iron
pr0kazn1k, 2017-06-05 11:06:56

Peewee data lazy loading, no subqueries?

There is a VkUserGroup model that links two tables


class VkUserGroup(BaseModel):
vk_user = ForeignKeyField(VkUser)
vk_group = ForeignKeyField(VkGroup)
class Meta:
db_table = 'vk_users_groups'
primary_key = CompositeKey('vk_user', 'vk_group')

I make a request

query = VkUserGroup.select().limit(10)
for vk in query.execute():
print(vk)

As a result, they receive +2 requests to pull up VkUser and VkGroup, although {vk_user_id, vk_group_id} is enough for me.
How to get rid of additional data loading?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2018-09-30
@Vlad_IT

And if there are 20 cores, but with a frequency of 1 GHz? So far, the priority is performance per core. A good processor with good performance per core, with 4 cores and 8 threads will be suitable for most modern games.

A
Amffore, 2018-09-30
@Amffore

At least 4 cores. For example i3 8100, or i5 of past generations. The video card plays a greater role than the processor, but below 1050ti I see no reason to consider it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question