statistics MDL-25822 Fix get_records_sql returning non-unique first column