58567976f52236d49e021449f49002a6b133dadb
tdreszer
  Thu Aug 30 14:27:28 2012 -0700
Redmine 8961. Galt found this error and found the solution too.  Big-beds in dense never support filtering and rely upon a summary query, rather then querying all items in the range.
diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c
index 7920d0d..a5d33c2 100644
--- src/hg/hgTracks/bigBedTrack.c
+++ src/hg/hgTracks/bigBedTrack.c
@@ -42,31 +42,31 @@
     bbi = track->bbiFile = bigBedFileOpen(fileName);
     }
 return bbi;
 }
 
 struct bigBedInterval *bigBedSelectRange(struct track *track,
 	char *chrom, int start, int end, struct lm *lm)
 /* Return list of intervals in range. */
 {
 struct bigBedInterval *result = NULL;
 /* protect against temporary network error */
 struct errCatch *errCatch = errCatchNew();
 if (errCatchStart(errCatch))
     {
     struct bbiFile *bbi = fetchBbiForTrack(track);
-    if (!(track->limitedVisSet && track->limitedVis == tvDense))
+    if (actualVisibility(track) != tvDense) // dense always avoids this expensive query
 	{
 	int maxItems = maximumTrackItems(track) + 1;
 	result = bigBedIntervalQuery(bbi, chrom, start, end, maxItems, lm);
 	if (slCount(result) >= maxItems)
 	    {
 	    track->limitedVis = tvDense;
 	    track->limitedVisSet = TRUE;
 	    result = NULL;
 	    }
 	}
     if (actualVisibility(track) == tvDense)
 	{
 	AllocArray(track->summary, insideWidth);
 	if (bigBedSummaryArrayExtended(bbi, chrom, start, end, insideWidth, track->summary))
 	    {