mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-09-10 18:25:50 +00:00
fix: use index from_pubkey in nodes region filter (#1882)
The region subquery in GetNodes was pulling the advert pubkey out of decoded_json with JSON_EXTRACT for every row the join touched, instead of reading the from_pubkey column that #1143 already added and indexed It looks like buildPacketWhere, GetRecentTransmissionsForNode, QueryMultiNodePackets etc. moved to from_pubkey already, but not this.
This commit is contained in:
+4
-1
@@ -996,8 +996,11 @@ func (db *DB) GetNodes(limit, offset int, role, search, before, lastHeard, sortB
|
||||
if !db.isV3 {
|
||||
joinCond = "obs.id = o.observer_id"
|
||||
}
|
||||
// #1143: from_pubkey is a dedicated, indexed column populated at
|
||||
// ingest (and backfilled) for ADVERT rows specifically so pubkey
|
||||
// lookups don't need to JSON_EXTRACT + parse decoded_json per row.
|
||||
subq := fmt.Sprintf(`public_key IN (
|
||||
SELECT DISTINCT JSON_EXTRACT(t.decoded_json, '$.pubKey')
|
||||
SELECT DISTINCT t.from_pubkey
|
||||
FROM transmissions t
|
||||
JOIN observations o ON o.transmission_id = t.id
|
||||
JOIN observers obs ON %s
|
||||
|
||||
Reference in New Issue
Block a user