Skip to content

Commit

Permalink
perf: Faster "show title in link field" on list view (#25597) (#25622)
Browse files Browse the repository at this point in the history
Ideally, this query should be converted to "Top N" variant and just pick
first 20 records, join only them with other table and send data back.

Currently we always group by `name` in list view. This makes "show title
in link field" join queries insanely slow as it first queries entire
table and then applies limit.

(cherry picked from commit bad3b9e)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Mar 23, 2024
1 parent a39a093 commit f62a30c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frappe/public/js/frappe/list/base_list.js
Expand Up @@ -448,15 +448,22 @@ frappe.views.BaseList = class BaseList {
}

get_args() {
let filters = this.get_filters_for_args();
let group_by = this.get_group_by();
let group_by_required =
Array.isArray(filters) &&
filters.some((filter) => {
return filter[0] !== this.doctype;
});
return {
doctype: this.doctype,
fields: this.get_fields(),
filters: this.get_filters_for_args(),
filters,
order_by: this.sort_selector && this.sort_selector.get_sql_string(),
start: this.start,
page_length: this.page_length,
view: this.view,
group_by: this.get_group_by(),
group_by: group_by_required ? group_by : null,
};
}

Expand Down

0 comments on commit f62a30c

Please sign in to comment.