So I need to run a query that I do not know the UUID - but need to find it... so I am using the street num, street name, and a company UUID to find it
I have a few million records, and this took query is taking around an HOUR!!
any advice to speed it up?
gisPoints
UUID Indexed Unique varchar(36)
street_num int(11)
street_name varchar(128)
geoPoint_temp
UUID Indexed Unique varchar(36)
street_num int(11)
street_name varchar(128)
gcomUUID Indexed varchar(36)
update geoPoint_temp as temp JOIN gisPoints as `prod` on prod.gcomUUID=temp.gcomUUIDand prod.street_num=temp.street_num and prod.street_name REGEXP(temp.street_name)
set temp.UUID=prod.UUID,temp.customerUUID=prod.customerUUID WHERE temp.`uploadstate` = '1'";
This runs in 1.5 seconds opposed to the hours it was taking before Much help to @Webeng for pointing us in the right direction!
$custquery="UPDATE geoPoint_temp as temp
join
(
select prod.name, prod.street_num, prod.street_name, prod.UUID,prod.customerUUID, prod.gcomUUID
FROM gisPoints as `prod`
JOIN
(
select t1.gcomUUID , t1.street_num, t1.street_name
FROM geoPoint_temp as t1
) as sub1 on prod.gcomUUID =sub1.gcomUUID and prod.street_num=sub1.street_num
) as sub2 on sub2.gcomUUID =temp.gcomUUID
and sub2.street_num=temp.street_num
AND sub2.street_name LIKE (CONCAT('%',temp.street_name,'%'))
set temp.customerUUID = sub2.customerUUID, temp.UUID=sub2.UUID";
$custre=mysql_query($custquery);
if (!$custre) { echo 'Could not run custre query: ' . mysql_error(); exit; }