SA-MP Forums Archive
Millions insert in mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Millions insert in mysql (/showthread.php?tid=632105)



Millions insert in mysql - Bussyman - 09.04.2017

Hi,

I have about ~2mil messages in database. I'am loading for player, by his name, and it takes about ~2~-4 seconds to show. What when will by 200mil messages, and i need SELECT ? it takes 1,2 min to show ? what to do?


Re: Millions insert in mysql - OneDay - 09.04.2017

learn more sql here http://use-the-index-luke.com/


Re: Millions insert in mysql - denNorske - 09.04.2017

You should have split up / used another system to save the messages in the Database. You could have one table for all names that starts on "A" and another table with "B" and so on (depending on how many players u've got).

Also, you can read about load balancing. I don't think it's a good idea keeping all information in one table, especially when you have those amounts of data in it.


Re: Millions insert in mysql - Bussyman - 09.04.2017

Thanks for idea. What query should i do if i want to create tables, from that large messages? like there is name and message, and i want to create table sms_%s, and then write there that messages of that player.


Re: Millions insert in mysql - CXdur - 10.04.2017

I would really consider only storing them for a specific amount of time and perhaps deleting the rows in OnGameModeInit if they're older than this date.


Re: Millions insert in mysql - OneDay - 10.04.2017

MySQL can hold billions of things well if you use indexes correct.