Performance issue with poller-wrapper.py

I use LibreNMS to poll over 2500 devices across various locations, using multiple pollers and poller groups. To poll these devices, I rely on the “poller-wrapper.py” script wich works perfectly until recently.

I’m using dynamic groups, which are fabulous to sort and give permissions to users, but now I have maybe a hundred of them.

Recently, I observed a latency increase in my polls, and I noticed that the membership of a device in a dynamic group is verified at the end of the script, wich can take up to a minute or two.

Every 5 minutes, when the “poller-wrapper.py” script runs, it checks the device’s group membership via an SQL query “SELECT EXISTS (SELECT * FROM devices…)"

Now, I have 2 questions:

The first, is maybe a silly question, I’m not a SQL master, but with the “SELECT * FROM devices …” SQL Statement:
When it retrieves all columns using “SELECT *”, the database fetches unnecessary data, including columns it might not need.
This approach prevents the optimizer from making efficient choices, such as utilizing indexes effectively. Isn’t it ?

The second question, Is it possible to move the dynamic group membership check elsewhere ?

Like creating a separate script that runs on a node with easy database access and minimal latency.
This script can periodically check the group membership without affecting the main polling process.

Thanks for your time and your kind answer