vipyrsec / dragonfly-mainframe

The mainframe for Dragonfly
https://docs.vipyrsec.com/dragonfly-mainframe/
MIT License
5 stars 1 forks source link

Add index to `scans.finished_at` #175

Closed jonathan-d-zhang closed 1 year ago

jonathan-d-zhang commented 1 year ago

Improves perf by like 7x.

Benchmark script

#!/bin/bash
pgbench -n -f query.sql -T120 -P24 -c5 -j5 \
    postgresql://postgres:postgres@localhost:5432/dragonfly

Existing

number of transactions actually processed: 15987
latency average = 37.524 ms
latency stddev = 11.284 ms
tps = 133.229818 (without initial connection time)

After

number of transactions actually processed: 117929
latency average = 5.086 ms
latency stddev = 0.629 ms
tps = 982.929644 (without initial connection time)