Der Server(die Software) ist mit vollem Speicher konfigueiert(da ist ein Hacken gesetzt) - kann das das Problem sein?
Und jetzt glaube ich zu wissen woran es liegt. Vor zwei Monaten haben wir die Speicherauslastung gemessen. Das war jedoch auf dem alten DBServer, bei einer komplizierten Abfrage hat die Speichernutzung fast gar nicht geändert (maximal +/-30 MB), während beide CPU-Kerne mit 70% liefen.
SQLStatement besteht aus 3 UNION und es wird in einer VIEW(Sicht) gesucht, die aus 18 UNION ALL besteht(die Tabellen da haben ca.20 Spalten und von 100 bis 2.000.000 Zeilen, je nach Tabelle - VARCHAR, Integer, Real, Float). Und wenn es in der größten Tabelle gesucht wird, dann dauern die drei Abfragen ziemlich lang.
hier ist der php Code:
//query to get the result of a test analysis:
function queryTestAnalyis($values, $upstream, $downstream, $Restriction) {
//don't change order of the attributes
$return = "SELECT A_name, B_name, position, strand, ISNULL(C_position, A_position) AS A_position,
convert(varchar(50), score) as score, wert2, A_strand, lnp
FROM VIEW_all_bla_bla_blup
WHERE $upstream <= ISNULL(C_position, A_position) AND ISNULL(C_position, A_position) <= $downstream";
$ARestriction = getARestrictionForTestAnalysis($values, "A_name");
if ($ARestriction != "") {
$return .= " AND ($ARestriction)";
}
if ($BRestriction != "") {
$return .= " AND ($BRestriction)";
}
$return .= " UNION SELECT prev_A_name, B_name, position, strand, prev_A_position,
convert(varchar(50), score) as score, wert2, prev_A_strand, lnp
FROM VIEW_all_bla_bla_blup
WHERE $upstream <= prev_A_position AND prev_A_position <= $downstream";
$ARestriction = getARestrictionForTestAnalysis($values, "prev_A_name");
if ($ARestriction != "") {
$return .= " AND ($ARestriction)";
}
if ($BRestriction != "") {
$return .= " AND ($BRestriction)";
}
$return .= " UNION SELECT next_A_name, B_name, position, strand, next_A_position,
convert(varchar(50), score) as score, wert2, next_A_strand, lnp
FROM VIEW_all_bla_bla_blup
WHERE $upstream <= next_A_position AND next_A_position <= $downstream";
$ARestriction = getARestrictionForTestAnalysis($values, "next_A_name");
if ($ARestriction != "") {
$return .= " AND ($ARestriction)";
}
if ($BRestriction != "") {
$return .= " AND ($BRestriction)";
}
$return .= " ORDER BY A_name, B_name ASC";
return $return;
}
[/PHP]
Was uns noch aufgefallen ist: Die Funktion [PHP]getARestrictionForTestAnalysis($values, "A_name"); macht aus Values ein String mit OR-Verknüpfung - val1 OR val2 OR val3 usw. Solange die # von ORs <=64 - dauert die Suche maximal 10 Sekunden, ab 65 sofort 67 Sekunden, bei 100 ca. 92 Sekunden, bei 128 sinkt wieder auf 44, 197 - schon 18 Sek. Woran könnte es liegen? - deswegen dachten wir auch, dass es an dem Arbeitsspeicher liegt.