Most popular databases in 2018 according to StackOverflow survey

The survey results from StackOverflow's developers survey are already here, and we can now declare the most popular databases for 2018. Without further ado, let's look into the results: So what can we learn from these results? The most popular database is MySQL, and not by far comes SQL Server. This wasn't very surprising, as… Continue reading Most popular databases in 2018 according to StackOverflow survey

How to Transfer a MySQL Database Between Two Servers?

This post's contentExporting MySQL database to a dump fileSecure the backup fileTransfer the backup fileImport MySQL dump to new serverValidate imported data in new serverAnother export & import optionImportant Notes Migrating a MySQL database usually requires only few simple steps, but can take quite some time, depending on the amount of data you would like… Continue reading How to Transfer a MySQL Database Between Two Servers?

MySQL is not using my index – Join with a range condition

This post's contentThe ProblemPossible WorkaroundsSolving the problem using bad practice #1 (Run a query in a loop)Solving the problem using bad practice #2 (Cartesian product)Conclusion This post is based on a true story from one of our team members. Here at EverSQL, we have high appreciation for the MySQL database. Said that, every product has… Continue reading MySQL is not using my index – Join with a range condition

Faster Pagination in Mysql – Why Order By With Limit and Offset is Slow?

This post's contentWhy OFFSET is so slow?How to optimize slow OFFSET queries?Possible pitfalls / challengesConclusion Queries with LIMITs and OFFSETs are common in application that require pagination and in some cases might work well for a while. In many cases though, they become slow and painful once the OFFSET has a high value. Why OFFSET… Continue reading Faster Pagination in Mysql – Why Order By With Limit and Offset is Slow?

MySQL utf8 vs utf8mb4 – What’s the difference between utf8 and utf8mb4?

This post's contentThe Story of UTF8 VS UTF8MB4RecommendationHow to convert utf8 to utf8mb4 in MySQL? The Story of UTF8 VS UTF8MB4 I once got a call from the support team, saying that one of our customers reported that the application fails to save data in one of our business-critical features. The customer is seeing a… Continue reading MySQL utf8 vs utf8mb4 – What’s the difference between utf8 and utf8mb4?

5 Common Mistakes PHP Developers Make when Writing SQL

This post's contentDo not use the old mysql apiBad practice:Better practice:Do not escape client input using escaping functionsDo not assume prepared statements are always safe in PHPCode sample:Do not assume ORM frameworks are not prone to SQL injection attacksBad practiceBad practiceDo not underestimate the power of character encodingCode sampleSummary Do not use the old mysql… Continue reading 5 Common Mistakes PHP Developers Make when Writing SQL

Most popular databases in 2017 according to StackOverflow survey

UPDATE: The top databases for 2018 were declared by StackOverflow's 2018 survey. The survey results from StackOverflow's developers survey are already here, and we can now declare the most popular databases for 2017. Without further ado, let's look into the results: So what can we learn from these results? The most popular database is MySQL,… Continue reading Most popular databases in 2017 according to StackOverflow survey

Select max, min, last row for each group in SQL without a subquery

In several RDBMS databases, including MySQL, subqueries are often one of the causes for performance issues. Therefore, we have an incentive to avoid them whenever we can and to find alternative ways to implement our requirements. One of the most popular uses for subselects in SQL is when one needs to fetch the first, last,… Continue reading Select max, min, last row for each group in SQL without a subquery