Reputation: 6109
Is there any significant performance difference between the
func (db *DB) Query(query string, args ...interface{}) (*Rows, error)
and the
func (db *DB) QueryRow(query string, args ...interface{}) *Row
in the "database/sql"
package even if you have LIMIT 1;
at the end of your query?
Upvotes: 3
Views: 1973
Reputation: 16140
The difference is the overhead of a function call (i.e., almost nothing, compared to sending a query to your database). QueryRow calls Query, and then wraps the results in an sql.Row.
Upvotes: 3