WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:)

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.