I have a situation to choose between parsing XML documents in Oracle PL/SQL and parsing them in Java. The system receives the XML documents on a message queue and so the XML documents are not on the file system, unless I write them to the filesystem after reading from queue. And, the intent of parsing is to insert/update records in a bunch of database tables.
Which one is a better option from a performance stand-point?
It’s really a competition between PL/SQL and many possible Java parsers. It’s very likely that some of the Java parsers beat PL/SQL on performance.
Some other reasons to go with a Java parser:
However if you need to extract information from the XML and insert it into an Oracle database, the advantage might go to PL/SQL. In this case it might be worthwhile to prototype both approaches and see. Also consider the development time needed for each: if the number of bytes of XML coming into your system is relatively small, just pick the solution that’s fastest to implement.