Jump to content

Efficient MYSQL Join or Update


davewx

Recommended Posts

I have two tables of point data. The first main table has about 50,000 rows of data with values that represent the temperature for a grid point. I also have another table with about 25,000 rows of data. I'm trying to update the values from the second table into the first table for the closest point. Doing this using spatial functions in MYSQL would likely be slow, so I decided to do a spatial join in ArcGIS to give them relating ID's. As such, there are repeating id's from the second table in the first table as expected. This is because the grid spacing in the first (main) table is much smaller than the second table and there will be duplicate grid points with the same value...which is what I want. The only problem is, when I try to update the values by id = id, the query takes forever to complete. It seems as if its looping through each row for each time which seems very inefficient. 

 

Is there a better method for doing this?

UPDATE grid, hrdps_points SET grid.val=hrdps_points.value WHERE grid.hrdpsid = hrdps_points.id
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.