1d0084b02d134cc35c34481d5425902266d911f5 max Sun Jan 5 13:32:48 2014 -0800 As suggested by Hiram, inversing the strategy for table name checks:First try the full table name, then the split table name. All current assemblies use normal, non-split tables so this saves some mysql queries (and saves some time in the browser box) diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 67b4cb3..55fb7f9 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -3037,41 +3037,47 @@ hash = newHash(8); hashAdd(dbHash, db, hash); } if ((hti = hashFindVal(hash, rootName)) == NULL) { if ((sameString(rootName, "mrna") && sqlTableExists(conn, "all_mrna")) || (sameString(rootName, "est") && sqlTableExists(conn, "all_est"))) { safef(fullName, sizeof(fullName), "all_%s", rootName); rootName = fullName; } else { if (chrom != NULL) { + // first try the non-split table name then the split table name. + // This avoids many useless chrX_table lookups + // (today, very few assemblies have split tables) + isSplit = TRUE; + safef(fullName, sizeof(fullName), "%s", rootName); + if (sqlTableExists(conn, fullName)) + isSplit = FALSE; + else + { safef(fullName, sizeof(fullName), "%s_%s", chrom, rootName); if (sqlTableExists(conn, fullName)) isSplit = TRUE; - } - if (!isSplit) - { - safecpy(fullName, sizeof(fullName), rootName); - if (!sqlTableExists(conn, fullName)) + else return NULL; } } + } AllocVar(hti); hashAddSaveName(hash, rootName, hti, &hti->rootName); hti->isSplit = isSplit; hti->isPos = hFindBed12FieldsAndBinWithConn(conn, fullName, hti->chromField, hti->startField, hti->endField, hti->nameField, hti->scoreField, hti->strandField, hti->cdsStartField, hti->cdsEndField, hti->countField, hti->startsField, hti->endsSizesField, hti->spanField, &hti->hasBin); hti->hasCDS = (hti->cdsStartField[0] != 0); hti->hasBlocks = (hti->startsField[0] != 0); if (hti->isPos) { if (sameString(hti->startsField, "exonStarts")) hti->type = cloneString("genePred");