iç hızlandırmak için nasıl küçük bir tablo, büyük birleşim tablosu

0 Cevap php

dear php and mysql expertor i have two table one large for posts artices 200,000records (index colume: sid) , and one small table (index colume topicid ) for topics has 20 record .. have same topicid

curent im kullanılarak: (yuvarlak 0.4s aldı)

+do get last 50 record from table:

Sid DESC LIMIT 0,50 BY ORDER veryzoo_stories SELECT sid, yardım, başlık, zaman, konu, muhbir, iHome, alanguage, sayaç, tipi, resim, chainid

+then do while loop in each records for find the maching name of topic in each post:

while ( .. ) { SELECT topicname FROM veryzoo_topics WHERE topicid='$topic'" .... }

+Now I going to use Inner Join for speed up process but as my test it took much longer from 1.5s up to 3.5s

SEÇ a.sid, a.aid, a.title, a.time, a.topic, a.informant, a.ihome, a.alanguage, a.counter, a.type, a.images, a.chainid, t . veryzoo_stories DAN topicName sid DESC LIMIT 0,50 BY INNER JOIN veryzoo_topics t ON a.topic = t.topicid SİPARİŞ

It look like the inner join do all joining 200k records from two table fist then limit result at 50 .. that took long time..

Please help to point me right way doing this.. eg take last 50 records from table one.. then join it to table 2 .. ect

0 Cevap