Hacker News new | past | comments | ask | show | jobs | submit login
Poor count() performance with MySQL compared to PostgreSQL with JSON datasets (malloc.fi)
2 points by velmu on May 25, 2020 | hide | past | favorite | 2 comments

Did you try SELECT COUNT(*) FROM trip ?

MySQL has optimizations for that, and since you’re counting the primary key column, which can’t contain NULL values, the result will be the same.

You might want to move the JSON column to a separate table with a 1:1 relationship (same primary key) to keep the row size down in the main table.

What are the advantages of using JSON instead of Blob in the DB and convert the blob in JSON in code?

Applications are open for YC Winter 2024

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact