This commit is contained in:
parent
7688e4d3a8
commit
c0019d7246
14
src/ssb.db.c
14
src/ssb.db.c
@ -193,7 +193,9 @@ void tf_ssb_db_init(tf_ssb_t* ssb)
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_sequence_index ON messages (author, sequence)");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_timestamp_index ON messages (author, timestamp)");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_channel_author_timestamp_root_index ON messages (content ->> 'channel', author, timestamp, content ->> 'root')");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_contact_index ON messages(author, sequence, content ->> '$.contact', content ->> '$.following', content ->> '$.blocking') WHERE content ->> '$.type' = 'contact'");
|
||||
_tf_ssb_db_exec(db,
|
||||
"CREATE INDEX IF NOT EXISTS messages_contact_index ON messages(author, sequence, content ->> '$.contact', content ->> '$.following', content ->> '$.blocking') WHERE "
|
||||
"content ->> '$.type' = 'contact'");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_id_author_index ON messages (id, author)");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_size_by_author_index ON messages (author, length(content))");
|
||||
_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_timestamp_index ON messages (timestamp)");
|
||||
@ -1664,11 +1666,11 @@ static sqlite3_stmt* _make_following_statement(sqlite3* db)
|
||||
sqlite3_stmt* statement = NULL;
|
||||
|
||||
if (sqlite3_prepare(db,
|
||||
"SELECT content ->> '$.contact' AS contact, content ->> '$.following', content ->> '$.blocking' "
|
||||
"FROM messages "
|
||||
"WHERE author = ? AND content ->> '$.type' = 'contact' AND contact IS NOT NULL "
|
||||
"ORDER BY content ->> '$.contact', sequence",
|
||||
-1, &statement, NULL) != SQLITE_OK)
|
||||
"SELECT content ->> '$.contact' AS contact, content ->> '$.following', content ->> '$.blocking' "
|
||||
"FROM messages "
|
||||
"WHERE author = ? AND content ->> '$.type' = 'contact' AND contact IS NOT NULL "
|
||||
"ORDER BY content ->> '$.contact', sequence",
|
||||
-1, &statement, NULL) != SQLITE_OK)
|
||||
{
|
||||
tf_printf("prepare failed: %s", sqlite3_errmsg(db));
|
||||
}
|
||||
|
@ -1622,7 +1622,10 @@ void tf_ssb_test_following_perf(const tf_test_options_t* options)
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
const char** ids = tf_ssb_db_get_all_visible_identities(ssb, 2);
|
||||
while (ids[count]) { count++; }
|
||||
while (ids[count])
|
||||
{
|
||||
count++;
|
||||
}
|
||||
tf_free(ids);
|
||||
}
|
||||
uint64_t end = uv_hrtime();
|
||||
|
Loading…
x
Reference in New Issue
Block a user