Hi,
Here's a question about resource consumption of database queries. I read in Reversi Tutorial that it's better to avoid lots of queries when possible, but I'd like to have more details about this.
I'd like to know if the action in itself of connecting to the database requires time, or if it's the query that is time consuming (which would mean that the complexity of the query makes a big difference). Or both.
Answers to the following questions could help me :
- Is it better to use getActivePlayerId and then getActivePlayerName (2 queries, but they're very simple), or to use loadPlayersBasicInfos (only one query, but with informations we don't need)?
- if during the same game state I need 2 or 3 times (in different methods) one row (each time a different one) of a large database table (say, about 100 rows of 8 or 10 fields), I have 2 options : get the entire table once, and pass it to the methods that need a row, or in each of the 2 or 3 method, send a new query to get the single row I need. Is one of these options far better than the other one?
Thanks a lot
Here's a question about resource consumption of database queries. I read in Reversi Tutorial that it's better to avoid lots of queries when possible, but I'd like to have more details about this.
I'd like to know if the action in itself of connecting to the database requires time, or if it's the query that is time consuming (which would mean that the complexity of the query makes a big difference). Or both.
Answers to the following questions could help me :
- Is it better to use getActivePlayerId and then getActivePlayerName (2 queries, but they're very simple), or to use loadPlayersBasicInfos (only one query, but with informations we don't need)?
- if during the same game state I need 2 or 3 times (in different methods) one row (each time a different one) of a large database table (say, about 100 rows of 8 or 10 fields), I have 2 options : get the entire table once, and pass it to the methods that need a row, or in each of the 2 or 3 method, send a new query to get the single row I need. Is one of these options far better than the other one?
Thanks a lot