Hi,
it will be good if you could post the queries you use + the explain output.
Thanks
Le sam. 9 févr. 2019 à 17:46, Evandro Abreu <evandro.abreu@xxxxxxxxx> a écrit :
I have a report that takes about 20 minutes to generate. It is generated from 3 tables: according to image.The report input parameter is a date range. So to generate it I select all records in Table A and run themin loop-for. For each record in Table A I make a query Table B join with Table C where I filter the records through the date field and make the sumof the value field.Given this scenario, I would like your help in finding a solution that can reduce the generation time of this report. System developed in PHP / Laravel.PostgreSQLmax_connections = 50shared_buffers = 4GBeffective_cache_size = 12GBmaintenance_work_mem = 1GBcheckpoint_completion_target = 0.7wal_buffers = 16MBdefault_statistics_target = 100random_page_cost = 4effective_io_concurrency = 2work_mem = 83886kBmin_wal_size = 1GBmax_wal_size = 2GBLinux Server CentOS 7, Single Xeon 4-Core E3-1230 v5 3.4Ghz w / HT, 16GB RAM.I've already created indexes in the fields that are involved in the queries.Database schemaReport result--Atenciosamente,Evandro Abreu.Engenheiro de Sistemas at STS Informática Ltda.Google Talk: evandro.abreuTwitter: http://twitter.com/abreu_evandroSkype: evandro_abreuPhone: +55 86 98835-0468