[performance] Update indexes that were causing slow db queries (#855)

* add status.url index, use id desc in some indexes

* test account last posted
This commit is contained in:
tobi 2022-09-26 14:43:19 +02:00 committed by GitHub
commit 429bb770e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 0 deletions

View file

@ -139,6 +139,12 @@ func (suite *AccountTestSuite) TestUpdateAccount() {
suite.WithinDuration(time.Now(), noCache.UpdatedAt, 5*time.Second)
}
func (suite *AccountTestSuite) TestGetAccountLastPosted() {
lastPosted, err := suite.db.GetAccountLastPosted(context.Background(), suite.testAccounts["local_account_1"].ID)
suite.NoError(err)
suite.EqualValues(1653046675, lastPosted.Unix())
}
func (suite *AccountTestSuite) TestInsertAccountWithDefaults() {
key, err := rsa.GenerateKey(rand.Reader, 2048)
suite.NoError(err)