A system, comprising: at least one processor; and a memory having computer-executable instructions stored thereupon which, when executed by the at least one processor, cause the system to: analyze (1710, 1910) recurring query subgraphs to determine features of operator subgraphs of queries; using a machine learning algorithm, train (1720, 1920) a particular cardinality model to predict cardinalities as output, for each particular operator subgraph of the operator subgraphs based at least on the features and actual runtime statistics included in the recurring query subgraphs for at least two different queries that include different parameters or different data inputs, the particular operator subgraph comprising a sequence of operators that occurs in the at least two different queries; store the particular cardinality models; receive a query having particular operator subgraphs that can be used to execute the query; retrieve respective cardinality models for the particular operator subgraphs; predict cardinalities of the particular operator subgraphs using the respective cardinality models; and select a specific operator subgraph of the particular operator subgraphs having the lowest cardinality to utilize for execution of the query. at least one processor; and a memory having computer-executable instructions stored thereupon which, when executed by the at least one processor, cause the system to: analyze (1710, 1910) recurring query subgraphs to determine features of operator subgraphs of queries; using a machine learning algorithm, train (1720, 1920) a particular cardinality model to predict cardinalities as output, for each particular operator subgraph of the operator subgraphs based at least on the features and actual runtime statistics included in the recurring query subgraphs for at least two different queries that include different parameters or different data inputs, the particular operator subgraph comprising a sequence of operators that occurs in the at least two different queries; store the particular cardinality models; receive a query having particular operator subgraphs that can be used to execute the query; retrieve respective cardinality models for the particular operator subgraphs; predict cardinalities of the particular operator subgraphs using the respective cardinality models; and select a specific operator subgraph of the particular operator subgraphs having the lowest cardinality to utilize for execution of the query. analyze (1710, 1910) recurring query subgraphs to determine features of operator subgraphs of queries; using a machine learning algorithm, train (1720, 1920) a particular cardinality model to predict cardinalities as output, for each particular operator subgraph of the operator subgraphs based at least on the features and actual runtime statistics included in the recurring query subgraphs for at least two different queries that include different parameters or different data inputs, the particular operator subgraph comprising a sequence of operators that occurs in the at least two different queries; store the particular cardinality models; receive a query having particular operator subgraphs that can be used to execute the query; retrieve respective cardinality models for the particular operator subgraphs; predict cardinalities of the particular operator subgraphs using the respective cardinality models; and select a specific operator subgraph of the particular operator subgraphs having the lowest cardinality to utilize for execution of the query.