48 points · by BillFranklin · 7y ago · 16 comments
What's more, all this could have been avoided if a proper relational database structure (not even denormalized, GordonS) was there in the first place.
Querying the json is why this is slow. Pull that garbage out of the json and into a couple of tables and you'd be much faster.
It looks to me like a user-generated search query, not normalized data. A blob column makes perfect sense if this is the case, and pulling it out into other tables/columns would significantly overcomplicate everything else.
I don't buy that. Tables aren't complex.
https://www.postgresql.org/docs/9.3/sql-creatematerializedvi...
I do not understand this line very well. If order does not matter, why sort anything?
But then perhaps it is worth storing it sorted ( or as well if original value is important) and making it even faster?
Article is very application-specific, but is perhaps a reminder that denormalisation can be useful when working with relational databases.
But json to postgres 9.3 is no better than an abitrary string that stores a delimited list.
This is a denormalized workaround for a denormalized schema, with big performance gains.