mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
search v2: pre-allocate dashboardQueryResult slice capacity for performance (#91536)
* search v2: pre-allocate dashboardQueryResult slice for performance * use limit parameter for starting slice size
This commit is contained in:
parent
53cfdf0ef8
commit
b6de9e9d3c
@ -846,7 +846,7 @@ func (l sqlDashboardLoader) loadAllDashboards(ctx context.Context, limit int, or
|
|||||||
attribute.Int64("lastID", lastID),
|
attribute.Int64("lastID", lastID),
|
||||||
))
|
))
|
||||||
|
|
||||||
rows := make([]*dashboardQueryResult, 0)
|
rows := make([]*dashboardQueryResult, 0, limit)
|
||||||
err := l.sql.WithDbSession(dashboardQueryCtx, func(sess *db.Session) error {
|
err := l.sql.WithDbSession(dashboardQueryCtx, func(sess *db.Session) error {
|
||||||
sess.Table("dashboard").
|
sess.Table("dashboard").
|
||||||
Where("org_id = ?", orgID).
|
Where("org_id = ?", orgID).
|
||||||
|
Loading…
Reference in New Issue
Block a user