Closed soedirgo closed 1 year ago
Benchmark on 1000 tables, 4 columns each:
Schema:
do $$ DECLARE myvar integer; begin for myvar in 1..1000 loop EXECUTE format('CREATE TABLE sbtest%s ( id SERIAL NOT NULL, k INTEGER NOT NULL, c CHAR(120) NOT NULL, pad CHAR(60) NOT NULL, PRIMARY KEY (id))', myvar); end loop; end; $$
Workload: GET /tables?include_columns=false
GET /tables?include_columns=false
Before: https://explain.dalibo.com/plan/h044ad2ae694gfc7
Time (mean ± σ): 8.886 s ± 0.220 s [User: 0.100 s, System: 0.022 s] Range (min … max): 8.666 s … 9.201 s 10 runs
After: https://explain.dalibo.com/plan/0a506f9b827e1b4c
Time (mean ± σ): 404.1 ms ± 103.5 ms [User: 94.7 ms, System: 15.1 ms] Range (min … max): 352.2 ms … 697.2 ms 10 runs
Conclusion: 20x speedup by using group by instead of aggregate filters.
group by
I've tested that the output is consistent on /tables and /generators/typescript between this and the one on prod, so I think we're good :+1:
/tables
/generators/typescript
Benchmark on 1000 tables, 4 columns each:
Schema:
Workload:
GET /tables?include_columns=false
Before: https://explain.dalibo.com/plan/h044ad2ae694gfc7
After: https://explain.dalibo.com/plan/0a506f9b827e1b4c
Conclusion: 20x speedup by using
group by
instead of aggregate filters.