优化看板打开速度

This commit is contained in:
GoEdgeLab
2022-03-27 16:39:54 +08:00
parent f5a58cbbbd
commit c0bd07409b
8 changed files with 120 additions and 82 deletions

View File

@@ -334,7 +334,7 @@ func (this *ServerDomainHourlyStatDAO) FindTopDomainStatsWithServerId(tx *dbs.Tx
Table(table).
Attr("serverId", serverId).
Between("hour", hourFrom, hourTo).
UseIndex("hour").
UseIndex("serverId", "hour").
Result("domain, MIN(serverId) AS serverId, SUM(bytes) AS bytes, SUM(cachedBytes) AS cachedBytes, SUM(countRequests) AS countRequests, SUM(countCachedRequests) AS countCachedRequests, SUM(countAttackRequests) AS countAttackRequests, SUM(attackBytes) AS attackBytes").
Group("domain").
Desc("countRequests").

View File

@@ -33,12 +33,13 @@ func TestServerDomainHourlyStatDAO_FindAllPartitionTables(t *testing.T) {
t.Log(dao.FindAllPartitionTables())
}
func TestServerDomainHourlyStatDAO_IncreaseHourlyStat(t *testing.T) {
func TestServerDomainHourlyStatDAO_InsertManyHourlyStat(t *testing.T) {
dbs.NotifyReady()
for i := 0; i < 1_000_000; i++ {
var count = 1
for i := 0; i < count; i++ {
var f = string([]rune{int32(rands.Int('0', '9'))})
if i % 30 > 0 {
if i%30 > 0 {
f = string([]rune{int32(rands.Int('a', 'z'))})
}