SQL-query takes looong time
postgresql version 8.3.7 When we use "IP Device Info" and enter the name of a SRV the resulting page takes minutes to load. Thanks to the useful Debug:-line at the bottom of the page I know this is because of this query: SELECT "cam"."camid", "cam"."netboxid", "cam"."sysname", "cam"."ifindex", "cam"."module", "cam"."port", "cam"."start_time", "cam"."end_time", "cam"."misscnt", "cam"."mac" FROM "cam" WHERE "cam"."netboxid" = 566 ORDER BY "cam"."start_time" ASC LIMIT 1 Time: 174.495 The result of this query is 0 lines since this is a SRV and not a GW/GSW. If I drop the "ASC LIMIT 1" from the query I get the answer in no time. I hope somebody with more SQL-knowledge than me can come up with a fix, since this is quite annoying. --Ingeborg -- Ingeborg Østrem Hellemo -- ingeborg.hellemo@uit.no (Univ. of Tromsø, Norway)
The result of this query is 0 lines since this is a SRV and not a GW/GSW. If I drop the "ASC LIMIT 1" from the query I get the answer in no time.
This is a known bug, which is fixed in trunk. The patch can be found in http://metanav.uninett.no/hg/default/rev/b2d0a4699bb1
I hope somebody with more SQL-knowledge than me can come up with a fix, since this is quite annoying.
Quick fix: CREATE INDEX cam_netboxid_start_time_btree ON cam USING btree (netboxid, start_time); Try that one and see if that fixes the problem. - Kristian -- Mvh Kristian Klette «Programs for sale: Fast, Reliable, Cheap: choose two.»
participants (2)
-
Ingeborg Hellemo -
Kristian Klette