Skip to main content
Question

Looping with a FeatureReader


johnk
Contributor
Forum|alt.badge.img+4
  • Contributor

Hi FME world,

I have two tables in a database (ArcGIS SDE). They are effectively a 1:1 match, linked via a common ID. Table 1 features are always present in the flow (filtered prior) and I want to read in ONLY the features from table 2, where match with the Table 1 filtered features (because there are 1m+).

I’ve tried options like aggregating the Table 1 features and concatenating the ID, passing into Table 2 feature reader with a where clause. However, there is a maximum limit of queries the database can do (somewhere between 10,000-15,000 - and often I will need to read in more than this.

My next thought is to create a looping transformer where I sample the T1 features into groups of 10k, aggregate, pass to FeatureReader, reads in associated 10k T2 features, then loop back to read in the next 10k, until there are no more features to be read (using a NoFeaturesTester to exit the loop.

I’m a bit stuck on how to actually implement this though. Any ideas/thoughts much appreciated! Or if i’m missing something really obvious, please tell!

Thanks!

4 replies

j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • May 20, 2025

Not sure the looping of a feature reader is going to achieve this, also you can’t parse a list/array of ID values into a where clause attribute = list of ID values.

Rather than the second feature reader, you could try using the DatabaseJoiner transformer using Join on = the ID. The beauty of this transformer is it will show you what joined and the unjoined. Also it has cardinality options for dealing with duplicate/multiple matches and you get to choose ‘fields to add’, where as other joins give you all attributes of both sides


johnk
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • May 20, 2025

Hi ​@jbotterill, thanks for the super speedy reply! 

I have tried the DatabaseJoiner as an option and it just seems to be really slow. Processing ~4 features at a time and in my current test, it has to get to 45k - so probably at least at hour.

Any optimization tips?


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • May 20, 2025

If you are not necessarily manipulating the geometry of the features, you could establish a connection to the underlying database, rather than through SDE format, then use a SQLexecutor and have the query and where.

https://community.safe.com/s/article/performance-tuning-fme 

  • avoid passing lists (arrays) into transformers that don’t use them
  • keep attributes to as few as possible. The AttribtueKeeper can help here if you really have a lot
  • avoid group based transformers or those which break bulk mode where possible (look at the feature count and for messages in the log file)
  • ensure your FME_TEMP has plenty of disk space

hkingsbury
Celebrity
Forum|alt.badge.img+55
  • Celebrity
  • May 20, 2025

Comparatively, SDE is slow, there is a lot of overhead before even getting to read data. Agree with ​@j.botterill that looping isn’t going to solve it and the DatabaseJoiner is worth investigating.

 

You can read SDE tables directly from the underlying database, this will be much faster than using the SDE reader. This means you could do a select clause with a join and let the DB do the hard work.

Taking that approach does require solid knowledge of how SDE stores the data. Depending on your versioning/archiving settings you may need to use a view instead of the table


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings