Raysmond / SpringBlog

A simple blogging system implemented with Spring Boot + Hibernate + MySQL + Bootstrap4.
http://raysmond.com
BSD 3-Clause "New" or "Revised" License
1.64k stars 695 forks source link

Add Index on posts to Accelerate Query #36

Open wtune opened 4 years ago

wtune commented 4 years ago

Problem

posts is an important table in SpringBlog and from PostRepository we can find that we always read posts by permalink and post_type.In our test, adding index on posts.permalink and posts.post_type can really improve related querys' performance up to 85%.Therefore, the performance impact for write operations is acceptable under common cases.

Possible Soultion

Add Index on posts.post_type and posts.permalink