sql - Improving update performance in ACCESS -
i have 2 tables in access:
tbl_rm: (+ primary key) + customername (short text) + countrycode (short text) + rmdate (date/time - format mmm-yy) + serialnumber (short text) blackclicks (double) colorclicks (double) accentclicks (double) professionalcolorclicks (double)
the second table
tbl_invoices: (+ primary key) + customername (short text) + countrycode (short text) + invoicedate (date/time) + serialnumber (short text) blackclicks (double) colorclicks (double)
tbl_rm contains 98 496 records (out of 9113 match query below)
tbl_invoices contains 9 618 records (all matching below request).
i want update tbl_invoices data tbl_rm. here update query:
update tbl_invoices inner join tbl_rm on tbl_invoices.customername = tbl_rm.customername , tbl_invoices.countrycode = tbl_rm.countrycode , tbl_invoices.serialnumber = tbl_rm.serialnumber , month(tbl_rm.rmdate) = month(tbl_invoices.invoicedate) , year(tbl_rm.rmdate) = year(tbl_invoices.invoicedate) set tbl_invoices.blackpages = tbl_rm.blackclicks + tbl_rm.accentclicks, tbl_invoices.colorpages = tbl_rm.colorclicks + tbl_rm.professionalcolorclicks
when running in access 2013 takes hours compute. guess there way speed up. suggestion welcome.
the first suggestion index on tbl_rm(customername, countrycode serialnumber)
. might enough. if not might need handle dates in index well.
Comments
Post a Comment