Which would provide the best performance for working within ArcMap with very large datasets stored in an ArcSDE geodatabase? Multiple label classes using complex SQL queries to label specific features, or multiple copies of the same layer using the same complex SQL queries set as a definition query for each layer?
-
2I think "multiple copies of the same layer each with their own definition query and simple field based labeling" will go in as favourite but I have no metrics to back up that gut feeling so I think this is a great question. Would a file geodatabase feature class with one million polygons qualify as a very large dataset in your parlance?– PolyGeo ♦Commented Sep 29, 2014 at 7:29
3 Answers
Assuming the SQL queries on the label classes are the same as the ones on split out layers, the single layer approach with multiple label classes will be faster. Why?:
Labeling in ArcMap will execute one query for the layer draw and then one query for each label class. So a layer with 4 label classes will query once (1 query) for all features drawn and then 4 additional times total (one for each label class or 4 more queries) = 5 total queries
If you split the layers out, you'll have 1 filtered query (definition query) for each layer (4 queries) plus that same query for each label class (4 more queries) = 8 total queries
In almost all cases, 5 queries will be faster than 8 queries due to just plain query overhead although it depends on the data source.
Note, in ArcGIS Server a cache is used for feature labeling and 1 layer with 4 label classes will most likely be handled via one query when the label classes use fairly standard SQL without vendor specific functions.
-
2But, with the definition query scenario, I would not create label classes. They would just be labeled based on a single field value. Or am I reading the third paragraph incorrectly?– ianbroadCommented Sep 29, 2014 at 18:56
-
Label classes are used to label a subset of features defined by a SQL where clause (exactly the same as a definition query) and have their own text symbol, label expression, and placement rules. It's unclear to me from your description how moving from classes to a definition query allows you to label just on a single field. Are you referring to complex label expressions not complex SQL queries? Commented Sep 30, 2014 at 4:47
-
1No, I just mean that for both scenarios, neither uses a label expression. Both are labeled using a single field.– ianbroadCommented Sep 30, 2014 at 15:12
-
4I work on the labeling team at Esri. I'm intimately familiar with how this works. Calling location of the query won't affect performance, but you'll want to reduce total queries. Commented Oct 2, 2014 at 4:41
-
1I think I understand your answer now Craig, but I wonder if there is some way to reword it to make it easier to understand. I had to read it a few times to realize your math is actually probably not wrong like I and others first thought. Commented Oct 4, 2014 at 11:41
I ran a few very simple tests using some NHD data coming from an SDE connection and found very little difference between either method.
- 7 Label Classes in a single layer, also 7 separate symbologies: 36 seconds
- 7 Separate layers with definition queries, single label class in each with no query: 37 seconds
A few caveats:
- My test was very simple with simple labels and simple queries, complex queries should be tested since that was part of the question.
- About a third of the total time was for drawing the symbology.
- My timing was with a stop watch so margin of error is pretty big.
-
+1 for your tests. I wonder if it makes a difference whether label conflicts occurs or not? Perhaps you can enlarge the font size so that a lot of lables will overlap. Then disable place overlapping labels option. Is there a difference now?– JensCommented Oct 1, 2014 at 15:13
-
1Actually there was a lot of label conflicts in my tests because I had to show a large extent to get a really long processing time that I could easily measure. Commented Oct 1, 2014 at 17:29
-
1There's no such thing as "no label classes" as there's always one. Commented Oct 3, 2014 at 7:58
-
I think the definition query would be faster because it's at the object level and not at the attribute data level.
You would still have to test. However I would use definition queries and not label classes.
-
1Yes, please test (and report back if you can). I also lean to definition queries, but for usability performance reasons. The label expression dialogs are painfully sluggish and several click layers deeper than the def query ones. They're also easier to get at in python. Commented Oct 1, 2014 at 4:37
-
I don't think this qualifies as an answer without some sort of technical basis or quantitative testing. It might mislead some people. Would have been better as a comment to the original question. Commented Oct 1, 2014 at 14:21
-
I would have done that if I had the capability to comment. Thanks for the down vote. Just trying to help out.– geogeekCommented Oct 1, 2014 at 18:18