I am using grails 2.3.8 with mysql database. I have this domain class with 200,000 records. It takes 18 seconds to retrieve.
class Alert {
Long id
int recorded_at
int responded_at
String source_name
String source_type
String check_name
String label
String priority
String status
String message
String remarks
Date dateCreated
Date lastUpdated
static mapping = {
table "alerts"
version false
dateCreated column: "created_at"
lastUpdated column: "updated_at"
message type: "text"
remarks type: "text"
recorded_at index: 'Recorded_Atx'
//sort recorded_at: "desc"
}
static constraints = {
responded_at(nullable:true)
message(nullable:true)
remarks(nullable:true)
}
}
def alerts = Alert.findAll()
why?