[wp-trac] [WordPress Trac] #49479: Does $wpdb->get_row() add LIMIT 1 to the query?
WordPress Trac
noreply at wordpress.org
Thu Feb 20 04:21:49 UTC 2020
#49479: Does $wpdb->get_row() add LIMIT 1 to the query?
-------------------------+------------------------------
Reporter: lambasoft | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 5.3.2
Severity: normal | Resolution:
Keywords: close | Focuses: performance
-------------------------+------------------------------
Changes (by ayeshrajans):
* keywords: => close
* severity: major => normal
Comment:
Hi @lambasoft - Welcome to WordPress Trac.
To answer your question: No, it does not add a `.. LIMIT 1` clause to the
query. It runs the query, and returns one result and that's it. I suppose
adding `LIMIT 1` would give a performance benefit, but this `get_row` is
meant to be used on database structures that contains exactly one result
or none (for example to load a user by a specific ID). To load multiple
results, use `wpdb::get_results`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49479#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list