django-wagtail-feeds icon indicating copy to clipboard operation
django-wagtail-feeds copied to clipboard

Feeds generate n+1 queries for related image content

Open ckinsey opened this issue 5 years ago • 1 comments

  • Django Wagtail Feeds version: 0.1.0
  • Python version: 3.6.5
  • Operating System: Mac OSX 10.14

Description

Extended feeds executen+1 queries to gather image content from StreamFields.

What I Did

Here's a traced transaction from our APM tool:

Screen_Shot_2019-04-08_at_3_34_19_PM

I'm not sure what tools Wagtail provides for prefetching associated images from RichTextBlocks in StreamFields, but for large feeds this can generate 100s or 1000s of database queries to render a single feed.

Happy to spend some time on this and see if I can find a fix, but wanted to make sure I wasn't missing some easily configurable thing like subclassing the feed object overriding a queryset or something.

ckinsey avatar Apr 08 '19 20:04 ckinsey

@ckinsey I think I'm the one that missed the performance hit! It was quick and dirty implementation that I had intended to get back too but I just did not have the time. We'll be grateful if you could take a look

chrisdev avatar Apr 09 '19 15:04 chrisdev