Skip to content

Some queries could be cached for efficiency #4

@clupasq

Description

@clupasq

There are three queries in UdgerParser.cs that have no filters. This means that the same data (and all data) is selected from the DB every single time a detection is being made:

//client
DataTable clientRegex = dt.selectQuery(@"SELECT class_id,client_id,regstring,name,name_code,homepage,icon,icon_big,engine,vendor,vendor_code,vendor_homepage,uptodate_current_version,client_classification,client_classification_code
                      FROM udger_client_regex
                      JOIN udger_client_list ON udger_client_list.id = udger_client_regex.client_id
                      JOIN udger_client_class ON udger_client_class.id = udger_client_list.class_id
                      ORDER BY sequence ASC")
DataTable osRegex = dt.selectQuery(@"SELECT os_id,regstring,family,family_code,name,name_code,homepage,icon,icon_big,vendor,vendor_code,vendor_homepage
                      FROM udger_os_regex
                      JOIN udger_os_list ON udger_os_list.id = udger_os_regex.os_id
                      ORDER BY sequence ASC")
DataTable device = dt.selectQuery(@"SELECT deviceclass_id,regstring,name,name_code,icon,icon_big
                      FROM udger_deviceclass_regex
                      JOIN udger_deviceclass_list ON udger_deviceclass_list.id=udger_deviceclass_regex.deviceclass_id
                      ORDER BY sequence ASC")

Using the test database, these queries bring 141, 165 and 42 records respectively.

Given the fact that the DB is essentially read-only from the perspective of the Udger Client and that the same data is retrieved every time, I think that these records could be cached to avoid 3 DB roudtrips on every detection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions