Looping on Data vs Fetching from a database
#1

You see, I was making a /stats command. In this command, the player would be able to see the houses that he bought. Now, would it be better looping through thousands of houses just to find his house, or fetching the house data from a table right there?

I'm basically weighing down the different scenarios to (possibly) avoid the worst execution time in the command.
Reply
#2

fetching the house data from a table right there for sure, a loop that is almost infinite has a big chance to crash your server and you don't want that , right?
Reply
#3

Quote:
Originally Posted by Eth
Посмотреть сообщение
fetching the house data from a table right there for sure, a loop that is almost infinite has a big chance to crash your server and you don't want that , right?
That was my first impression too (I don't know how I came up that looping is more efficient than constantly fetching). Given your input, I'll be applying the latter.
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)