Home > database >  PostgreSQL summary is slow.
PostgreSQL summary is slow.

Time:09-15

Select substring (newcomcode, 1, 6), sum (rateamount) from SFF where deskdate between '20191101'
And '20191130'
And the substring (newcomcode, 1, 4)='3209'
And kindcode in (' R10 ', 'R91', 'R92')
And the substring (classescode, 1, 1) in (' D ') group by 1;


Summary data is very slow, a month to run six hours, don't know where is wrong, how to modify, thank you for the teacher for help,

CodePudding user response:

A month data? If more, you may need to partition table to solve this problem, if less, you may lack of a proper index,

CodePudding user response:

Sounds good

CodePudding user response:

Between the and into greater than, less than a try, time indexed, should be faster
  • Related