We are setting up a new Oracle enterprise geodatabase. This set up involves an external procedure that runs on a weekly basis to update data on a table.
Part of this external procedure has a SQL query (below) to select a subset of data based on a spatial relationship using the ST_Intersects function. In our current environment, this statement takes less than a minute to run. In our new environment, we are encountering performance issues on the "AND t1.field2 != t2.field3" portion of this statement - to the tune of it never completing. If we take this statement out of the query, the query runs fine, so we have been able to narrow this performance issue to this particular statement.
Both tables (Table1 and Table2 in the query below) have spatial indexes and attribute indexes associated with them.
Any ideas on what we could try to get this to successfully run?
SELECT t1.field1, t1.field2, t2.field3 FROM Table1 t1, Table2 t2
WHERE sde.st_intersects(t2.shape, sde.st_pointonsurface((t1.shape))) = 1
AND t1.field2 != t2.field3
AND t2.field3 != 'Attribute';
Thanks - Josh