PDA

View Full Version : Questions about query_read() vs. query_read_slave()


RagedGamers
06-11-2010, 03:20 PM
I'm developing a plugin with a lot of SQL reads and I'd like to optimize it as much as possible. One optimization I'd like like to look into is switching all of my query_read functions to query_read_slave functions.

I've read that query_read_slave() should be used when timing is not vital (source (https://vborg.vbsupport.ru/showpost.php?p=1781613&postcount=3)).


Is there a performance increase even when there's no slave DB?
What are some examples of situations where timing would be vital vs. not vital?


I've also read that "you only use query_read_slave when you have more than 1 query running together" (source (https://vborg.vbsupport.ru/showpost.php?p=1949140&postcount=5)).


Is this true? If so, can somebody explain this further?


If you guys can answer some of these questions, I would be very grateful. :)

Marco van Herwaarden
06-12-2010, 07:43 AM
If there is no slave database, there should be no increase or descrease in performance.

Displaying the result of a search is for example not considered critical, reading the permissions of a user in order to determine if the post he is making is allowed might be critical.

RagedGamers
06-14-2010, 02:21 AM
Alrighty. Thanks for clearing that up!