Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some queries could be cached for efficiency #4

Open
clupasq opened this issue Sep 8, 2016 · 0 comments
Open

Some queries could be cached for efficiency #4

clupasq opened this issue Sep 8, 2016 · 0 comments

Comments

@clupasq
Copy link

clupasq commented Sep 8, 2016

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.

@clupasq clupasq changed the title Some queries could be cached for effieciency Some queries could be cached for efficiency Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant