Database Optimization: Saving Time and CPU Usage

908 Words2 Pages

Database optimization is something, that while may go unnoticed, is very important a very important for saving time and CPU usage. In attempting queries on the math database downloaded form stackexchange. A query is an expression written in a programming language, in this case SQL, that is used for data look up in a database. Stackexchange is a large compressed file that contains a record of all the forums from the website stackoverflow.com. I specifically used the math files since they are one of the largest files in size and serve as a perfect example for why database optimization, and finding efficient SQL queries is important. I have noticed that complicated queries can be optimized to make for faster, more complete results. With the size of the files that I was using to create my database each being any where from 30 megabytes to 600 megabytes, which inserted a few hundred thousand lines of data into my tables, even simple queries, such as “SELECT * FROM posts”, that normally take less than a second to run were taking as long as 10 or 15 seconds. From experimentation and research, the best way speed up queries are, knowing you database, being specific, and using techniques, such as indexes.
Matthias Jarke and Jurgen Koch's paper Query Optimization in Database Systems also displayes the continued importance of finding way to make efficient queries when using a database system. “Efficient methods of processinf unanticipated queries are a crucial prerequisite for the success of generalized database management systems.”( Query Optimization in Database Systems) The paper also explains the importance of knowing the database and what you are searching for. Also explained is the importance of finding alternate ways to make a quer...

... middle of paper ...

... to shorten the amount of time I spent waiting for a query to finish. The biggest improvements came form using indexes and joins. Using an index made it so the queries had a sort of reference when searching and performing operations on specific columns. Joins decreased the amount of operations the system had to process and made the biggest difference in run time. As databases grow it is important to try and reduce the over all cost by optimizing queries.

Works Cited
"2012-02-15Slow Indexes, Part II." Slow SQL Indexes. N.p., n.d. Web. 10 Apr. 2014.
"2.6. Joins Between Tables." PostgreSQL: Documentation: 8.3: Joins Between Tables. N.p., n.d. Web. 10 Apr. 2014.
"CREATE INDEX." PostgreSQL: Documentation: 9.1: CREATE INDEX. N.p., n.d. Web. 10 Apr. 2014.
"Query Optimization in Database Systems." Query Optimization in Database Systems. N.p., n.d. Web. 10 Apr. 2014.

More about Database Optimization: Saving Time and CPU Usage

Open Document