Current algorithms to match XML query twig patterns in a parallel GPU multi-threaded computing platform are only fit for systems with a maximum of several dozen threads. The technology presented is a novel algorithm for matching twig patterns in large XML documents, using GPU. The algorithm efficiently exploits both the high-bandwidth GPU memory interface and the lower-bandwidth CPU main memory and is suitable for systems with many hundreds of threads. The invention can be used to upgrade database systems that support XML documents to work in multi-core GPU environments and can significantly improve their performance.