Search found 7 matches

by bncplix
Thu Dec 24, 2009 8:56 pm
Forum: Databases
Topic: How to optimize this setup?
Replies: 11
Views: 1126

Re: How to optimize this setup?

I have reworked how things work and it seems MUCH faster now. Now I added a temp table, and all the new data is inserted from here. The original one has the indexes, and it is only read from. Every day at 3AM, all the data from the temp table is dumped into the main one and the temp is wiped. Everyt...
by bncplix
Mon Dec 21, 2009 4:36 pm
Forum: Databases
Topic: How to optimize this setup?
Replies: 11
Views: 1126

Re: How to optimize this setup?

ORDER BY RAND() is very slow. aside from that, you need to be hitting indexes as Vlad pointed out. Please post the EXPLAIN results on your query as he requested. Heres the PHP code to basically show how I have it setup:   $result = mysql_query("SELECT id as systemid, username as username, pass...
by bncplix
Mon Dec 21, 2009 4:12 pm
Forum: Databases
Topic: How to optimize this setup?
Replies: 11
Views: 1126

Re: How to optimize this setup?

You don't have any indexes created - that's why your join query is sooo slow ;) Create indexes for userid and systemid in your follows table. Then run your join query with EXPLAIN clause. I removed them as I wasnt sure if writing at the same time woulc cause a problem. How can i join it into 1 quer...
by bncplix
Mon Dec 21, 2009 3:27 pm
Forum: Databases
Topic: How to optimize this setup?
Replies: 11
Views: 1126

Re: How to optimize this setup?

Post your table CREATE scripts. Is this what your talking about?: CREATE TABLE `follows` (  `id` int(11) NOT NULL auto_increment,  `userid` int(8) NOT NULL default '0',  `systemid` int(8) NOT NULL default '0',  PRIMARY KEY  (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2951408 DEFAULT CHARSET=latin1 And: C...
by bncplix
Mon Dec 21, 2009 3:05 pm
Forum: Databases
Topic: How to optimize this setup?
Replies: 11
Views: 1126

How to optimize this setup?

Okay so as my mysql database increases, my speed drastically decreases. So I have a table called follows. This table consists of id, userid and system id. All are int values. Currently, this table has 2.5 million records, gaining anywhere between 30,000 and 200,000 a day. I also have a table named S...
by bncplix
Sat Feb 07, 2009 1:35 pm
Forum: PHP - Code
Topic: Explode Problem!
Replies: 2
Views: 181

Re: Explode Problem!

Post some sample HTML of what you are trying to parse. This can be much more easily accomplished with regular expression. Maybe something like $html = file_get_contents('http://forum.tibia.com/forum/?subtopic=worldboards');   preg_match_all('#boardid="([^"]+)#', $html, $matches);   echo '...
by bncplix
Sat Feb 07, 2009 10:16 am
Forum: PHP - Code
Topic: Explode Problem!
Replies: 2
Views: 181

Explode Problem!

Ok, so I am making something that will rip down a forum by parsing the thead IDS and the thread name. So far I have it working to rip off the forum IDS and print them, then I use that forum ID to try and go back and parse again to get the thread ID. It will only get the first forum name and then sto...