Accelerating SQL Database Operations on a GPU with CUDA

Abstract Prior work has shown dramatic acceleration for various data-base operations on GPUs, but only using primitives that are not part of conventional database languages such as SQL. This paper implements a subset of the SQLite virtual machine directly on the GPU, accelerating SQL queries by executing in parallel on GPU hardware. This dramatically reduces the effort required to achieve GPU acceleration by avoiding the need for database programmers to use new programming languages such as CUDA or modify their programs to use non-SQL libraries.

This paper focuses on accelerating SELECT queries and describes the considerations in an efficient GPU implementation of the SQLite command processor. Results on an NVIDIA Tesla C1060 achieve speedups of 20-70x depending on the size of the result set. This work is compared to the alternative query platforms developed recently, such as MapReduce implementations, and future avenues of research in GPU data processing are described.

Papers P. Bakkum and K. Skadron. Accelerating SQL Database Operations on a GPU with CUDA. In GPGPU '10: Proceedings of the Third Workshop on General-Purpose Computation on Graphics Processing Units, pages 94-103, New York, NY, USA, 2010. ACM.

P.Bakkum and K. Skadron. Accelerating SQL Database Operations on a GPU with CUDA: Extended Results. University of Virginia Department of Computer Science Technical Report CS-2010-08, May 2010.

Implementation You can find the code and assets on GitHub.
The code associated with this project is also available below. The code is intended only for research purposes only and we make no guarantees about performance on your own machine.

sphyraena.tar.gz (2526 KB) (2533 KB)

The code is currently copyright Peter Bakkum, permission is provided to use it for research.

The code makes use of the SQLite database. Documentation and source code is provided at the SQLite website. SQLite is in the public domain.

Authors Peter Bakkum is a graduate of the University of Virginia. He is the contact for any issues related to the source code and can be reached at

Kevin Skadron is a Professor at the University of Virginia Department of Computer Science. More information can be found on his website.

Copyright The content of this webpage and source code linked therein is copyright Peter Bakkum.
The content of "Accelerating SQL Database Operations on a GPU with CUDA" is copyright the ACM.

Please note that papers linked here represent author preprints. The official, published version must be obtained from the publisher's website or the published print copy. This material is presented here to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each document's copyright terms. In most cases, these works may not be reposted without the explicit permission of the copyright holder. Permission is given to make digital or hard copies of all or part of this material without fee for personal or classroom use, provided that the copies are not made or distributed for profit or commercial advantage, and that copies bear the appropriate copyright notice and the full bibliographic citation on the first page. Copyrights for components of this work owned by others must also be honored. To copy otherwise, to republish, to post on servers, to redistribute to lists, etc. requires specific permission and/or a fee. In particular, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works, must be obtained from the copyright owner.

Please note further that any opinions, findings, conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the sponsoring agencies, employers, or publishers.