A query is preprocessed for features identified by a Data Manipulation Language (DML) in the text of the query. A machine-learning algorithm uses the features as input and provides as output a predicted query parsing execution time needed by a query parser to parse the query. The predicted query parsing time is provided as input to a query optimizer. The query optimizer uses the predicted query parsing time as a factor in optimizing a query execution plan for the query. Subsequently, the query execution plan is executed against a database as the query.