perf: avoid correlated channel scans in portrait queries
This commit is contained in:
@@ -125,7 +125,7 @@ func (r *channelRepo) Games(ctx context.Context, scope business.ChannelGameScope
|
||||
mode = 1
|
||||
}
|
||||
query := func(table string, dedup int) *gorm.DB {
|
||||
return db.Table(table+" r").Where("r.source_db = ? AND r.game_id > 0 AND r.dedup_mode = ?", scope.Root.SourceDB, dedup).Where("EXISTS (?)", channelGameTree(db, scope).Select("1").Where("p.id=r.promote_id AND p.source_db=r.source_db"))
|
||||
return db.Table(table+" r").Where("r.source_db = ? AND r.game_id > 0 AND r.dedup_mode = ?", scope.Root.SourceDB, dedup).Where("(r.source_db,r.promote_id) IN (?)", channelGameTree(db, scope).Select("p.source_db,p.id"))
|
||||
}
|
||||
// 累计起点按当前人数口径的日汇总最早日期决定,与原画像查询一致。
|
||||
begin := scope.BeginDate
|
||||
|
||||
Reference in New Issue
Block a user