- Aims This study assesses the attributable impact of adherence to oral glucose medications as a risk factor for poor glycemic control in population subgroups of a large general population, using an objective medication adherence measure. Methods Using electronic health records data, adherence to diabetes medications over a two-year period was calculated by prescription-based Medication Possession Ratios for adults with diabetes diagnosed before January 1, 2010. Glycemic control was determined by the HbA1c test closest to the last drug prescription during 2010–2012. Poor control was defined as HbA1c>75 mmol/mol (9.0%). Medication adherence was categorized as “good” (>80%), “moderate” (50–80%), or “poor” (<50%). Logistic regression models assessed the role medication adherence plays in the association between disease duration, age, and poor glycemic control. We calculated the change in the attributable fraction of glucose control if the non-adherent diabetic medication population would become adherent by age-groups. Results Among 228,846 diabetes patients treated by oral antiglycemic medication, 46.4% had good, 28.8% had moderate, and 24.8% had poor adherence. Good adherence rates increased with increasing disease duration, while glycemic control became worse. There was a strong inverse association between adherence level and poor control (OR = 2.50; CI = 2.43–2.58), and adherence was a significant mediator between age and poor control. Conclusions A large portion of the diabetes population is reported to have poor adherence to oral diabetes medications, which is strongly associated with poor glycemic control in all disease durations. While poor adherence does not mediate the poorer glycemic control seen in patients with longer-standing disease, it is a significant mediator of poor glycemic control among younger diabetes patients. A greater fraction of poorly controlled younger patients, compared to older patients, could be prevented if at least 80% adherence to their medications was achieved. Therefore, our results suggest that interventions to improve adherence should focus on this younger sub-group.