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

Machinetracker MAC search performs unnecessary join with Netbios table #1780

Closed
lunkwill42 opened this issue Sep 27, 2018 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@lunkwill42
Copy link
Member

Cognate with #235, the Machine tracker MAC search also performs a join with the Netbios table, regardless of whether the user has checked the "netbios" checkbox in the search form (observed in NAV 4.8.5)

The join uses the PostgreSQL OVERLAPS operator to match arp and netbios records on time ranges, and performs quite badly once the number of netbios records grows (which is a good reason to try to switch to using the tsrange data type for tables like arp, cam and netbios in the future - those can be be more efficiently indexed)

@lunkwill42 lunkwill42 added the bug label Sep 27, 2018
@lunkwill42 lunkwill42 added this to the 4.8.6 milestone Sep 27, 2018
@lunkwill42 lunkwill42 self-assigned this Sep 27, 2018
@lunkwill42
Copy link
Member Author

These are the offending lines:

arp_result = Arp.objects.select_related('netbox').filter(
end_time__gt=from_time,
mac__range=(mac_min, mac_max)
).extra(
select={'netbiosname': get_netbios_query()},
).order_by('mac', 'ip', '-start_time')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant