Advices and questions about MySQL
#1

Hello!
I want to ask a few advices and questions about MySQL:

1) If I call query and before delete the cache I call another query is there an possibility for confusion with the two caches? (for example I call mysql_query and before delete the cache I call mysql_pquery)

2) With mysql_tquery or mysql_pquery cache is delete automatically when you return 1 in the callback. But what happens if the query is UPDATE, INSERT or DELETE? With this query you doesn't use a callback, but there is still cache that return the amount of affected rows. So in this situation is the cache deleted automatically without using a callback and return 1?

3) Which way if faster for retrieving data from query - with using indexes (cache_get_value_index) or using names (cache_get_value_name)?

4) Is there a possibility for the cache not to be deleted, because of server crash? For example let's have this situation:
Code:
//Here I call a query

//Here the server crashes

//Here the cache is deleted, but we never get here, because server already crashed
Is this situation possible or the cache always gets deleted?

5) I'm thinking which way is better for saving player achievements. I have two ideas:

Idea one: Use a field in the default user table to describe every achievement with 0 or 1 if it's locked or not. Example: 0 1 1 0 0 1. But for this idea I have to add a VARCHAR field with big size if the achievements are much and also when achievement is modified I need a loop for every achievement to concatenate the new string and in login I need another loop to split the string.

Idea two: Use another table with every row describes user id which achievement id unlocked. That means the table will have a lot of data and with every login in the server there will be a query for the login user id to look in the whole table which achievements ids is there.

So what idea is better or there is a better solution?
Reply


Messages In This Thread
Advices and questions about MySQL - by Brooks1 - 14.04.2019, 17:15

Forum Jump:


Users browsing this thread: 1 Guest(s)