I've got a datasync server with a bit under 100 users on it mostly serving a fairly even mix of iOS and Android devices. Fully patched up, running in a VM with 2 vCPUs and 4gb RAM. The server is running well, no issues from a user side, but as of late I've noticed I can't get it below 10-15% CPU utilization (and climbing over the past few weeks - it was 5% when this problem started). I've traced it to Postgresql, and monitoring the pg_stat_activity table it seems to me to be related to the following query executing almost constantly:
SELECT * FROM Attachments WHERE state = E'1' ORDER BY tStamp ASC LIMIT 30

Manually running that query in psql returns zero results but no errors or anything. The database seems healthy, and this problem didn't pop up related to a patch or anything, it just seemed to have come up out of the blue, so I'm soliciting some opinions. Do you think it's just related to starting to pile up users on it, or do you think I may have a blown up index or something?