Fix #1463 by doing one only query for N tables of the same schema instead of N

@Kartones what do you think about this? I thought this should cause some improvement, since it reduces this request from 20 database queries to 1 (the number of different schemas) in most cases, but local and staging timings show no improvement at all (10 samples). I *think* this should be positive, but maybe I'm missing something.