Add a new Flag Counts relationship to avoid slow quries with the general Flags relationship.

Created on 8 May 2024, 7 months ago

Problem/Motivation

Let's say you have an article content with 'Like' flags. And you want to create a table with just two fields:

  • Content title
  • Number of likes

To implement this, currently you have to implement a "Flags" relationship, which creates a JOIN to the flagging table to do a WHERE on the flag type value and another join on flag_counts table to get the count. This can get slow if there are a multiple likes for a content on the site.
This can get reallllyyyy slow if any kind of aggregation is added to views.

Steps to reproduce

Proposed resolution

Add a new relationship for flag counts for an entity that bypasses the join to flagging table and uses flag_counts table directly.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

4.0

Component

Views integration

Created by

🇮🇳India dipakmdhrm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024