I've been working with a set of client textbases for a little while, and have been flummoxed by Inmagic Webpublisher taking up to 30 seconds to return a puny 50 record result set. There are a lot of secondary link fields in these textbases, and I had a gut feeling they were to blame. Somehow.
I assumed the link fields were pointing to local dev copies of the secondary textbases. I was wrong. I just discovered that the link fields were trying to reach out via UNC path to a servername in my client's network environment. Ah.
Almost every query except the cached ones were attempting to resolve this network path, thus accounting for the incredible amount of time spent churning. I had even noticed that refreshing the page after a timeout got the full query results in a fraction of a second, but didn't connect the dots. (I.e. query results were completed in every case, so the response wasn't hung up on the query process per se.)
Sigh. The hardest thing to do when troubleshooting is to uncover one's own assumptions.