Query processor ran out of internal resources and could not produce a query plan” - MariaDB i have some query 

SELECT  COUNT(loan_payment) as setcolumn
    FROM  table1
    WHERE  paydate between {d '2020-05-01'} AND {d '2020-05-31'}
      and  period_code = 'MONTHLY'
      AND  company_id = 11111
      AND  ( emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
                        'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
                        'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
                        'DO2071741','DO2071739','DO2071740','DO2071751')
              OR  emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
                        'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
                        'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
                        'DO2071741','DO2071739','DO2071740','DO2071751')OR emp_id IN ('DO2071406',
                        'DO2073897','DO2073464','DO2071522','DO2071400','DO2071401',
                        'DO2071402','DO2071403','DO2073538','DO2074215','DO2074233',
                        'DO2070850','DO2071618','DO2070442','DO2071741','DO2071739',
                        'DO2071740','DO2071751')OR emp_id IN ('DO2071406','DO2073897',
                        'DO2073464','DO2071522','DO2071400','DO2071401','DO2071402',
                        'DO2071403','DO2073538','DO2074215','DO2074233','DO2070850',
                        'DO2071618','DO2070442','DO2071741','DO2071739','DO2071740',
                        'DO2071751'
                          ) 


when i running i got error message like this 


this is a limitation from where in () condition ??

because previously i put all emp_id like this 

SELECT  COUNT(loan_payment) as setcolumn
    FROM  table1
    WHERE  paydate between {d '2020-05-01'} AND {d '2020-05-31'}
      and  period_code = 'MONTHLY'
      AND  company_id = 11111
      AND  ( emp_id IN ('DO2071406','DO2073897','DO2073464','DO2071522',
                        'DO2071400','DO2071401','DO2071402','DO2071403','DO2073538',
                        'DO2074215','DO2074233','DO2070850','DO2071618','DO2070442',
                        'DO2071741','DO2071739','DO2071740','DO2071751','DO2071406',
                        'DO2073897','DO2073464','DO2071522','DO2071400','DO2071401',
                        'DO2071402','DO2071403','DO2073538','DO2074215','DO2074233',
                        'DO2070850','DO2071618','DO2070442','DO2071741','DO2071739',
                        'DO2071740','DO2071751','DO2071406','DO2073897','DO2073464',
                        'DO2071522','DO2071400','DO2071401','DO2071402','DO2071403',
                        'DO2073538','DO2074215','DO2074233','DO2070850','DO2071618',
                        'DO2070442','DO2071741','DO2071739','DO2071740','DO2071751',
                        'DO2071406','DO2073897','DO2073464','DO2071522','DO2071400',
                        'DO2071401','DO2071402','DO2071403','DO2073538','DO2074215',
                        'DO2074233','DO2070850','DO2071618','DO2070442','DO2071741',
                        'DO2071739','DO2071740','DO2071751') 


i got some error message.
OR does not optimize well; don't use that form.
One of these indexes will be optimal; add both:

INDEX(company_id, period_code, paydate)
INDEX(period_code, company_id, emp_id)

{d '2020-05-01'} can be simply '2020-05-01'
You might find this easier to deal with

    paydate &gt;= '2020-05-01'
AND paydate  &lt; '2020-05-01' + INTERVAL 1 MONTH

COUNT(loan_payment) checks for NULL; perhaps you want simply COUNT(*)?