newttster Posted May 4, 2021 Posted May 4, 2021 When it comes to crons, is it better to have one query for each item or one query for multiple items where there is no WHERE clause. For example; $db->query("UPDATE users SET this+1"); $db->query("UPDATE users SET that+1"); $db->query("UPDATE users SET those+1"); OR $db->query("UPDATE users SET this+1, that+1, those +1"); Would you give some queries priority over others? In the example above (3 queries) would you put them in a different order or does that even matter? I'm wondering because a lot of times on other games, sometimes the cron will only complete some of the queries rather than all. Quote
peterisgb Posted May 4, 2021 Posted May 4, 2021 Me personally i kinda do both. depending on what its doing. Doing it all in one is alot cleaner and should be done where possible. Quote
AdamHull Posted May 4, 2021 Posted May 4, 2021 If they are seperate operations and not reliant on each other, i prefer to make them seperate querys. Makes it easy for other devs and easier for debugging Quote
KyleMassacre Posted May 4, 2021 Posted May 4, 2021 I wouldn’t think in an application like a web based game it matters all that much. Now if your handling 10s of thousands of transactions at a time, then maybe 1 hit to the database would be easier on your resources and be more efficient. Quote
athena26 Posted May 5, 2021 Posted May 5, 2021 Well I keep having a issue with my cron jobs all over a sudden they stopped working 😕 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.