Pquery & Tquery
#5

Mostly tqueries should do fine.
pqueries could be used when you're doing a MASSIVE query, which would take at least a few seconds to complete and you don't want other little queries to wait for the massive query to complete.

tqueries are put in a queue and are processed in the exact order you sent the queries.
So if your massive query would use a tquery, later queries will have to wait until that massive query has finished executing.

pqueries are processed at the same time and the first query could take more time than the second query, so the second query will be finished earlier.
There might be situations where this isn't wanted.
Sometimes you need one query to be finished first before the other so you send them right after eachother using tqueries.

Suppose you would use pqueries all the time and a new player logs in.
You ask for his password and you use a pquery to INSERT a new account into your database.
At the same time, you want new players to have a little starting cash, so you add another pquery to UPDATE his account with the given money.
Since an INSERT query takes more time, the UPDATE query will be finished earlier, but his account hasn't been created yet, so you will experience bugs.
The UPDATE query will fail as it can't find the account, then after this query failed, the account is added by the first query.

In such situations, you NEED to use tqueries as you need them to be executed in the exact order you sent the queries.


pqueries should only be used when you're doing a massive query which takes AT LEAST several seconds to complete.
Note that MySQL is pretty fast and such a query would need to gather ALOT of data, like 10.000+ rows.

I can't imagine any samp script would do such huge queries while the server is running.

Loading alot of data should be done before the server is online, and you can use mysql_query for those as well, so that you're certain your data is loaded before the server is opened up to the players, as mysql_query lets your script wait until the query is completed.
Reply


Messages In This Thread
Pquery & Tquery - by Sime30 - 08.02.2015, 14:30
Re: Pquery & Tquery - by HazardouS - 08.02.2015, 14:56
Re: Pquery & Tquery - by Sime30 - 08.02.2015, 15:10
Re: Pquery & Tquery - by Sime30 - 08.02.2015, 20:57
Re: Pquery & Tquery - by PowerPC603 - 08.02.2015, 23:12
Re: Pquery & Tquery - by Sime30 - 08.02.2015, 23:24
Re: Pquery & Tquery - by PowerPC603 - 08.02.2015, 23:35
Re: Pquery & Tquery - by Sime30 - 08.02.2015, 23:40

Forum Jump:


Users browsing this thread: 2 Guest(s)