This is one of those questions, where you think the answer should be straightforward yet eludes you, so hopefully somebody is able to help me out here.
I have 20,000 property IDs in my workbench, and I need to get additional attributes from a large PostGIS database table that contains several million records. This should be a simple join on the property IDs, but the problem is that FME is feature-based whereas any database is table-based.
If I put these 20,000 property IDs through a DatabaseJoiner, SQLExecutor or FeatureReader, it runs 20,000 individual queries rather than 1 single one, so is very slow and inefficient.
The second option (suggested by AI) is to write my property IDs to a temp table in PostGIS, and then do an inner join on the temp table. I don’t like this option as it means writing into my source PostGIS database, which is not a good idea. And writing the data into a table is ‘expensive’.
The third option would be to read all the properties from the PostGIS, and then do a FeatureJoiner or InlineQuerier, but we’re talking several millions of records, so not a desirable option.
The fourth option, and the option I’m currently going for, is Aggregating all the property IDs into a very long comma-separated string, and then use an SQLExecutor to convert it to an PostGISarray, and then query all records where the Property ID is in that array.
This works and is fast enough, but the string is enormous (300,000+ characters long) (see screenshot); it just doesn't look good.
Any other ideas how to join a database table when you have a large number of features in your workbench?




