Jump to content

loading large xml files


ProblemHelpPlease

Recommended Posts

http://www.w3schools.com/php/php_ajax_livesearch.aspI am trying to use a livesearch like the example on W3schools but I am running in to an issue.The xml file that is being searched for matching results is causing the livesearch to take ages to display any results. I know this is down to the size of the xml file as when it has around 1000 lines its ok but when I increase it to 5000 lines its very slow. It ideally needs to be more like 500,000 lines to contain all possible matches.Is this just a limit of what is physically possible or am I missing something?
Link to comment
Share on other sites

It doesn't require XML to function. You can just as easily search a database instead of an XML file, only quicker. There's no rule that says when Javascript sends a request that you must look up data in an XML file. That's just the example they have, because anyone can run it (because it doesn't require a database).

Link to comment
Share on other sites

I realise that now, I wasn't understanding your first reply correctly. What kind of load would this put on the server compared to using an xml file, if it will be detrimental to the site then its not worth the effort. I'm thinking in terms of the numerous connections to the database.

Link to comment
Share on other sites

The database will always be faster than the XML file. If both of them grow the same amount in size, and they both have the same number of people trying to connect, the database will be faster. It's going to take a lot more time and resources to read the entire XML file into memory, parse it up, and search through it. The entire database doesn't need to be in memory, for example, in order to read records from it, and the database storage engine is also optimized specifically for retrieving data. XML is just a general-purpose data storage format with a lot of overhead.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...