Use mysql_query instead of $wpdb query
Question
I have a custom table inside my wordpress database called test.
What if i query this table using mysql_query() instead of using for example $wpdb->get_results()
Will this affect my performance?
Ty very much:)
Solution
Simple and short:
- mysql_query() = Faster!
- $wpdb->get_results() = Safer!
But in most cases since $wpdb
is a global object and already in the memory using it will be be as fast as mysql_query()
.
Will this affect my performance?
It can affect for better performance changes but they would be minor changes that its just not worth it.
OTHER TIPS
Plugins caching DB queries hook into the WordPress API. If you don’t use the API your queries aren’t cached. The result is a slower site.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange