I just tried to run this little snippet in 'Execute Anonymous' on our org:
list<Case> caseList = [SELECT ID, Last_Case_Comment_By__c, Last_Case_Comment_Date__c, (SELECT ID, CreatedDate, CreatedBy.Name FROM CaseComments ORDER BY CreatedDate DESC)
FROM Case
WHERE ID IN (SELECT ParentID FROM CaseComment)
AND AccountID = '0018000000mHBLJ'
AND Last_Case_Comment_By__c = NULL
AND Last_Case_Comment_Date__c = NULL];
for(case c : caseList){
c.Last_Case_Comment_By__c = c.CaseComments[0].CreatedBy.Name;
c.Last_Case_Comment_Date__c = c.CaseComments[0].CreatedDate;
}
update caseList;
As you can see, it's pretty straightforward: I query all Cases that have at least one case comment belonging to a given account, then update a couple fields on the Case using data from the most recent comment.
caseList.size() = 1463
Number of query rows = 8737
Neither of these numbers seem particularly high.. does anyone have any insight into why this would hit the Apex CPU Time Limit error?
I threw a LIMIT 500 into the SOQL and it ran, so clearly processing the query is what's taking the time... but any ideas on what the big CPU consumer is in that Query?

CaseCommentinner join. Perhaps you could add a filter on that query to just search for comments whereCreatedDate = THIS_YEAR? – Adrian Larson Aug 22 '16 at 21:25LIMIT 1to yourCaseCommentssubquery. You don't need any of the older comments. – Adrian Larson Aug 22 '16 at 22:01WHERE <field> = nullis generally a performance killer as well. I don't know if it'd work on this query, but looking at the output of the query plan tool through the developer console might give you some additional insight. Leading operation type ofTablescanis bad. – Derek F Aug 22 '16 at 22:33