We have been talking in the team about speeding up one of our functions. I was 
wondering, would anyone know of a performant way to update a complete DataStore 
attribute (in principle, we re-compute a table column, and update all the 
values – say, after multiplication). The store is in PostGIS (1.5.x). Doing it 
through an iterator on a featureCollection seems to take really long.


We are using the code below, using
org.geotools.data.FeatureWriter:

Transaction transaction = new DefaultTransaction("update");
FeatureWriter<SimpleFeatureType, SimpleFeature> writer;

Filter filter = geodataFinder.getFilter(queryTxt);
writer = wifDataStore.getFeatureWriter(uazDBTable, filter, transaction);
try {
while (writer.hasNext()) {
SimpleFeature uazFeature = writer.next();
//do logic...
uazFeature.setAttribute(label,newScore);
writer.write();
}

LOGGER.info("attempting to modify {} features in : {}... it might take a 
while",featureCounter, uazDBTable);
                                transaction.commit();

LOGGER.info("done");


The logic takes approximately 3 seconds to execute,but then between the last 
two lines of logging information (the commit) it takes almost 2 min. to update 
a table of 31,000 rows. spatial indexes are on.

We are using Geotools 8.0M4


Thanks for any help,

Cheers,
Martin
--

Martin Tomko, PhD.
Senior Project Manager, Information Infrastructure Design, AURIN
Level 5, Architecture Building
University of Melbourne VIC 3010
AUSTRALIA

T:  +61 3 9035 3298
E:  [email protected] <mailto:[email protected]>
W: www.aurin.org.au <www.aurin.org.au>
W: http://www.tomko.org

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to