Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to optimize the following code ,I have number of rows 200 000 000 .
Is there a way to optimize it ?
let noRows = NoOfRows('CustomerTable')-1; for i=0 to $(noRows) let a = peek('Customer',$(i),'CustomerTable'); let b = peek('City',$(i),'CustomerTable'); let c = peek('Quantity',$(i),'CustomerTable'); GeocodeResponse: LOAD status, '$(a)' as CustomerName, '$(b)' as CustomerCity, '$(c)' as CustomerQuantity, ([result/geometry/location/lat]) as latitude, ([result/geometry/location/lng]) as longitude FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]); next i;
let noRows = NoOfRows('CustomerTable')-1;
for i=0 to $(noRows)
let a = peek('Customer',$(i),'CustomerTable');
let b = peek('City',$(i),'CustomerTable');
let c = peek('Quantity',$(i),'CustomerTable');
GeocodeResponse:
LOAD
status,
'$(a)' as CustomerName,
'$(b)' as CustomerCity,
'$(c)' as CustomerQuantity,
([result/geometry/location/lat]) as latitude,
([result/geometry/location/lng]) as longitude
FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]);
next i;
Maybe loading only distinct cities (fewer request, faster total load time)
LET x = FieldValueCount('City'); for i = 1 to x LET c = FieldValue('City',i); Coord: LOAD '$(c)' as City, ([result/geometry/location/lat]) as latitude, ([result/geometry/location/lng]) as longitude FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]); next; LEFT join (CustomerTable) LOAD * resident Coord; drop table Coord;
LET x = FieldValueCount('City');
for i = 1 to x
LET c = FieldValue('City',i);
Coord:
'$(c)' as City,
next;
LEFT join (CustomerTable)
LOAD * resident Coord;
drop table Coord;