Hi,
Im running a script where am I cross matching about 200 000 data sets with each other. Each data set consists of 8 parameters and I want to count all datasets which have similar or the same parameters for each data set.
Right now, I am doing the matching via a MySql query which im calling about 200 000 times. The problem is that using a query is extremely expensive… it takes up to 2 hours until the script is done. So I am wondering if there is a better method to cross match data sets and if some of could help me find a better solution.
While researching I found out that arrays may be a faster alternative to queries. And so far, I identified 3 possible ways for cross matching:
1. nested foreach () loops
foreach($array as ar1)
foreach($array as ar2)
if ($ar1[0] == $ar1[0])….
2. Using an Array_map with Callback function, so that i would have only one "hand coded" loop
foreach($array as arr)
if ($arr[0] == $parameter)….
3. Array walk where i could save one "hand coded" loop as well.
Theoretically would be the best/fastest way to go about it? Can Anyone tell me what technically the difference between those 3 ways is? And which one is the better approach or if there other alternatives to them?
I am thankful for any advice that helps me reduce execution time!
Menu restriction
How can I restrict the individual menu that would appear when a user logs in so that all users are confined to the transactions for which they have authorizations only as this also helps at a glance
Image DPI
Hi.I allow users to upload images, the user then is able to adjust several settings for the image:- Image quality (10 - 100)- watermark position(s) (top left/right, middle, bottom left/right)when the
TimeStamp Column Problem...
I'm mad at my self and thinking I'm a little retarded. It just be some one mistake I'm missing here. I coded my self a forum, when you reply to a topic, the topic's TimeStamp column is supposed to
Need help Updating SQL Server Express DB from c# :(
Please can anyone help with:-
help with email script...
hey I need help with my mail scriptwhen the form on http://www.mcgdesignstudio.com/contact.html is filled out, it send the from with no errors.. however i never receive it.. my hosting company have
Where am I going wrong
Been trying to work this out for hours I have two tables called 'Genres' and 'Films'. Genres contains two columns 'Genre_id' and 'Genre_Name'. Films contains a load of columns, the most important
INSERT for date range
Hi allI have the following tableCode: [Select] `date` date `day` int(2) `month` int(2) `year` int(4)If I pass a date range in PHP, such asCode: [Select]$datefrom = '2009-02-20';$dateto =
Search function
I am looking for some guidance from the experts.I am trying to create a search function. It will only be searching one table. The search criteria consists of two drop down menus. Each menu lists
PHP - MySQL Fail
My PHP code will only execute the first part of my code... Code: <?php session_start(); ?> <html> <head> <title> Create a
Is there something wrong?
Hi all,Just a quick question... can someone look at this code and see if something is wrong?Code: $j = 1;$vals = array();$feedline = array();foreach(explode($delimiter,$b) as $key => $values)