A Little mysql optimization
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
I haven't checked the top part, but the second part was just overkill. You're executing a query for every stat item you're saving, there's no need. If you created one large query, that would be the most efficient way to go. Use format and create a large string and bunch your queries in to one large query (or maybe 2), like so:

pawn Код:
new largeQuery[255]; // This is an extreme size for a string. Queries are usually large, so we need to create a large string. I have a query in a gamemode that I'm scripting that is around 1024 characters, so don't be afraid to increase the string size.
format(largeQuery, sizeof(largeQuery), "UPDATE something SET item1 = 'ya', item2 = 'ya', item3 = 'ya', item4  = 'ya'");
format(largeQuery, sizeof(largeQuery), "%s, item5 = 'ya' WHERE condition = '1'", largeQuery);
The reason for using multiple format()'s is because of the compiler input substitution feature which only reads so far through a line, you can use alternatives, but this is probably the easiest way.



Then get out.
https://sampforum.blast.hk/showthread.php?tid=55261

255 cells are same as 256 if i am wrong correct me.

so 256 tends to overkill.
Reply


Messages In This Thread
A Little mysql optimization - by wups - 15.10.2010, 16:19
Re: A Little mysql optimization - by Calgon - 15.10.2010, 16:25
Re: A Little mysql optimization - by wups - 15.10.2010, 16:30
Re: A Little mysql optimization - by Sergei - 15.10.2010, 16:32
Re: A Little mysql optimization - by Leeroy. - 15.10.2010, 16:33
Re: A Little mysql optimization - by Relixious - 15.10.2010, 16:35
Re: A Little mysql optimization - by Leeroy. - 15.10.2010, 16:38
Re: A Little mysql optimization - by Calgon - 15.10.2010, 16:40
Re: A Little mysql optimization - by Leeroy. - 15.10.2010, 16:43
Re: A Little mysql optimization - by wups - 15.10.2010, 16:43

Forum Jump:


Users browsing this thread: 1 Guest(s)