mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-07 06:25:16 +01:00
Improve profile fetch performance for large groups.
This commit is contained in:
committed by
jeffrey-signal
parent
d682de08d2
commit
1661f3b5f7
@@ -307,12 +307,15 @@ object SqlUtil {
|
||||
* This means chunking isn't necessary for any practical collection length.
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun buildFastCollectionQuery(
|
||||
column: String,
|
||||
values: Collection<Any?>
|
||||
values: Collection<Any?>,
|
||||
prefix: String = ""
|
||||
): Query {
|
||||
require(!values.isEmpty()) { "Must have values!" }
|
||||
return Query("$column IN (SELECT e.value FROM json_each(?) e)", arrayOf(jsonEncode(buildArgs(values))))
|
||||
val prefixFilter = if (prefix.isEmpty() || prefix.endsWith(" ")) prefix else "$prefix "
|
||||
return Query("$prefixFilter$column IN (SELECT e.value FROM json_each(?) e)", arrayOf(jsonEncode(buildArgs(values))))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user