SQL Database View vs. Join

963
1
11-18-2022 08:43 AM
Labels (3)
EPAGOADMIN
New Contributor

Hello,

I have a situation with two solutions that I can think of and I'm curious to know if one would be a preferred method. I have a SQL database (sde) that has some feature classes copied over from my ESRI Geodatabase. The database has a very large table containing a list of service orders. The end goal is to have a web map that will symbolize points in the feature classes (added via REST URL) based on the work order status from the table. I have a unique ID that matches features to work orders. Users will not need to use the resulting display to edit anything, all service order editing is done in third-party software.

Option one:

Create a new SQL view that selects a desired subset of attributes from feature class and service order table, sets desired WHERE clause and join the feature class data to the service order data based on the unique ID. Include the view in an ArcPro document, publish to federated server.

Option two:

In Pro document, add the feature class, join the feature class to the table containing the service orders. Set definition query on the feature class, make undesired fields not visible, publish to federated server.

 

I can provide more specifics if necessary, but I suppose my main question is, from a performance standpoint, are joins superior to views? Vice verse?

Tags (4)
0 Kudos
1 Reply
MarceloMarques
Esri Regular Contributor

Option One is always the preferable choice, the RDBMS View to perform the join of 2 or more tables is always faster, especially if the tables in question are quite large, you let the heavy lifting for the RDBMS engine to do the work for you, in the RDBMS is possible to create materialized Views when the tables involved in the join are very very large, the materialized view can improve performance considerably, so you have a lot of benefits going with Option One.

| Marcelo Marques | Principal Product Engineer | Esri |
| Cloud & Database Administrator | OCP - Oracle Certified Professional |
I work with Enterprise Geodatabases since 1997.
“ I do not fear computers. I fear the lack of them." Isaac Isimov