Jump to content

Recommended Posts

Guys just need your insights on a query algorigthm.  We have a very big database on a remote machine. From this database I need thre tables.  They are related in this way:

 

|Table 1|    |Table 2|    |Table 3|

|.....    |    |......    |    |.......  |

|Link  1|    |Link 1  |    |.......  |

|....      |    |Link 2  |    |Link 2  |

 

Using a join is out of the question since it crashes our network and our disk arrays. Hence, I got two options in mind:

 

1.  Use three queries with date filter and store it in different arrays then use the php to establish the relationships

2.  Use a main query at table 1 then use the link 1 as a filter for a query on a table 2 using for loop then use link 2 as a filter for a query on a table 3 using for loop.

 

I've done tests on a test server with local mysql data and seem no significant difference with respect to query speed and machine performance. However, I do not dare to implement it in production server before I get more insights as it might peg our network or worse lock the production db since it is way busier than the test server.

 

Thanks for your comments

Link to comment
https://forums.phpfreaks.com/topic/77327-solved-algorithm-help/
Share on other sites

Nah, the join version of these queries.

 

$qryCDR = "SELECT DISTINCT uniqueid,uid,clid,src,dst,origdst FROM cdr WHERE clid LIKE '%" . $strDisplay . "%' AND start BETWEEN '$starttime' AND
'$endtime'";
  $qryCP = "SELECT DISTINCT epoch,app,appdata,callid FROM callpath JOIN lookup_app ON lookup_app.appid=callpath.appid WHERE appexitstatus = -1 AND
from_unixtime(epoch) BETWEEN '$starttime' AND '$endtime'";
  $qryCID = "SELECT DISTINCT callid,uniqueid,uid from lookup_callid WHERE from_unixtime(substring_index(uniqueid,'.',1)) BETWEEN '$starttime' AND
'$endtime'";

 

there is just to many processes running on that db and with millions of records overhead join locks the db and we need a bucket of water for the disk arrays.  If a lock happens it mess up other systems as well. :(

Link to comment
https://forums.phpfreaks.com/topic/77327-solved-algorithm-help/#findComment-391654
Share on other sites

there is just to many processes running on that db and with millions of records overhead join locks the db and we need a bucket of water for the disk arrays.  If a lock happens it mess up other systems as well. :(

I have no idea what this means.

Link to comment
https://forums.phpfreaks.com/topic/77327-solved-algorithm-help/#findComment-394442
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.