Best practices for using nonspatial tables (SQL Views) as event layers?

6430
17
Jump to solution
02-04-2015 08:30 AM
SusanZwillinger
Occasional Contributor

To all of the ArcSDE experts,

 

What are your best practices for using nonspatial tables and/or SQL Server views as input for event layers?  The Help docs for 9.3 note that because ArcGIS cannot add an ObjectID field to a view, you cannot register a view with the geodatabase.  (I'm using 10.2, but I don't think this has changed.) If a view is not registered, it means that the table (even if it has a field called ObjectID) will not work properly as input for an event layer.  Sure, the event layer can be created, but if you try to query the data with a "Select by Attributes", you get very strange results.  In addition, you are not able to select features on the map with the Select tool.  This is a severe limitation when your data is changing frequently and you want users to be able to see those changes dynamically.  With large data files, the process to convert the event layer to a feature class is painfully slow.  So, any suggestions on best practices?  Would it help to create an indexed view in SQL Server? (Indexed views can provide better performance but this has to be weighed against the increased maintenance requirements of the database.  Would ArcGIS "recognize" an indexed view?)

 

Are we better off duplicating a view as a regular, indexed table and then registering that for the event layer?  This would require some kind of automatic trigger to re-create the table after the underlying tables were changed by users and seems like a very bad idea when you have multiple people editing the data.

 

I'm also wondering whether tables that are registered have limited functionality for ArcGIS Desktop Basic users versus ArcGIS Desktop Standard users.  Most of the users only have a Basic license and it would be costly to upgrade everyone to a Standard license.  Currently, the underlying SQL tables can be edited through a custom form in ArcGIS regardless of the license level being used.  When the data is refreshed, the event layers show the edits made by the users.

 

Regards,

-Susan-

0 Kudos
1 Solution

Accepted Solutions
VinceAngelo
Esri Esteemed Contributor

Best practice (and best performance) calls for actual geometries in your event tables (this allows for a spatial index to be used on draw, vice having to execute a full table scan query).  Given native geometry support on all platforms (which allows trigger-based point creation on insert and update), there really isn't any reason to use an Event Theme on a large database table.

It is not possible to register a view with a geodatabase (right-click 'Register' from Desktop).  Spatial views can be registered with ArcSDE (at 10.2.2 and earlier) using 'sdelayer -o register', but this is not the same as registering with the geodatabase (views must be simple feature classes, may only contain one topology type [Point/Line/Polygon], and must contain a unique non-zero positive rowid column [register with USER-set rowid]).

There is no difference in queries from a Desktop Basic client (vice Standard or Advanced); the difference is in administrative and data creation activities and in the size of the toolboox.

- V

View solution in original post

17 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Susan,

How you add a non-spatial table has changed, I believe starting at 10.0.  When you attempt to add a non-spatial table to ArcMap, it will be added a Query Layer.  You will be prompted to choose which field represents the Unique Identifier:

screen1.png

After selecting the Unique Identifier Field, you will be able to create an Event Layer and successfully query/select features within this layer.

SusanZwillinger
Occasional Contributor

Thanks for your helpful information, Jake.  I have used the Make Query Layer tool in ModelBuilder, and this does address some of the issues with event layers, but it doesn't seem to address the underlying performance issues.  I'm wondering if having an indexed view would help?  In addition, I'm wondering whether it is possible to register an indexed view with the geodatabase and whether the combination of the indexed view and the registered view would improve performance.

0 Kudos
EricKriener
New Contributor III

why the heck would you do this? not all data has a uid.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

Only data which does have a unique identifier can be used as a layer with ArcGIS.  The issue is the need to link the attribute table with the graphics plane, so that a click on the table can flash the graphic, and a click near the graphic can flash the attribute row.  If the rowid column isn't a UNIQUE, NON-ZERO, POSITIVE, 32-bit Integer, which returns the same value for the same feature, regardless of WHERE clause, then you could experience unexpected behavior.  Feature classes have an SDE-set rowid column by default.  Views (more specifically, 1:1 views) can use the registered rowid of the feature class, but 1:M and M:1 cardinality requires careful engineering of rowid designation.

- V

EricKriener
New Contributor III

then how do I geocode my SQL view (which can't be registered) and doesn't have (or need, frankly) uids?

0 Kudos
VinceAngelo
Esri Esteemed Contributor

You would ask a new question, to start.  Be sure to include as much information about the data and software in use as possible.  Good questions are more likely to result in good answers.  See my blog post for tips.

- V

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is there a reason you are looking at 9.3 Help even though you are using 10.2?  A lot has changed in nearly 7 years.

0 Kudos
SusanZwillinger
Occasional Contributor

Typically, I don't look at the old help files, but in this particular case I couldn't find the corresponding help topic when I looked in the 10.2 help file, so I thought that it may still be a limitation that you can't register a view with the geodatabase.  Have you ever tried to register a SQL Server View in 10.2 as opposed to registering SQL Server tables (which I know we can do)?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

You can see database views in ArcGIS Desktop just by connecting to a database, what functionality are you hoping to gain by registering a database view?  Is it not functionality but performance related?

0 Kudos