umaxim used Ask the Experts™
Hi i have a system which parse XML file with news. It gets it of article in database and then if it not there it add to database. But the problem is to many connection because it check every 15 minutes and it have 30 queries to database. So i thinking to make some cache for it maybe save last answer from XML and compare to new one and if it now the same then it begin checking. Or i thinking create some TXT file with all id of articles and then compare it to it. What else you can recommend what can help me ?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
30 queries to Database each 15 minutes doesn't seems like a big deal (although they're really heavy) What DBMS are you using?

You can check just the titles on database instead of checking the whole article (if you are doing so), also you can check just title and author if title don't seem enough precise for you.

Of course, you should use just one connection to execute all your queries (something on your question makes me think that maybe you're opening a new connection for each query, and even worse maybe you don't close them after!).


Yes i do not close them after how i can close i just new in regular programming. I every time use codeigniter it close connection by it self. What you can recomend m.
I don't know about CodeIgniter, it's some type of framework for PHP, I think.

Suposedly it should have some type of gargabe collection that closes any open connection when finishing to execute code, but I don't know if actually it has.

Keep in mind that your database will have a limit to the number of concurrent connections it can manage, also, more open connections means more resources.

You should try to use the minimum number of connections on your code, usually you create them on the fly when accessing database and close/destroy them when database operations are finished.

If you keep your database connections open, on the long run you'll find that your database runs slowly and, eventually, it blocks any further operation due to a too many open connections error.

The way you close your database connections on php could vary depending on the database.

This site has a full reference on PHP:


Thank you for help i found what was the error. I used persistent connection in my script and server every time show error too many connection. Thank you for help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial