At the beginning, we considered using MySQL's built-in variable system to replace podcast_id, and the start/end dates. The idea was to leverage the internal optimizer, which might have been capable of more efficient processing by recognizing these as variables. However, the outcome was the opposite. The optimizer became confused, leading to incorrect decisions that resulted in significantly longer query execution times—sometimes even resulting in timeouts of multiple minutes. This PR introduces variable replacement directly during SQL query generation on the client side, which should generally lead to faster execution times.
At the beginning, we considered using MySQL's built-in variable system to replace
podcast_id
, and thestart/end
dates. The idea was to leverage the internal optimizer, which might have been capable of more efficient processing by recognizing these as variables. However, the outcome was the opposite. The optimizer became confused, leading to incorrect decisions that resulted in significantly longer query execution times—sometimes even resulting in timeouts of multiple minutes. This PR introduces variable replacement directly during SQL query generation on the client side, which should generally lead to faster execution times.