put execution of partitition query into own function in order to make profiling easier