Open emptyflask opened 3 months ago
If I write it, would this be a welcome change?
My gut reaction is "no." Is this exposed in ActiveRecord at all? If I had an app that wanted this behavior I'd likely introduce something like:
def without_pg_jit(&block)
# turn off jit
yield
ensure
# turn on jit
end
Seems unlikely or at least not common to only experience an issue with JIT within Scenic so I'm hesitant to account for it here.
I don't believe it's exposed anywhere in Rails, for now I just do this in my test_helper.
ActiveRecord::Base.connection.execute("SET jit = off")
It would be convenient to have a built-in option, but you're right that it's not too difficult to just disable it in the migrations and anywhere else where a refresh is needed.
It might be worth a note in the documentation, since I assume most materialized views are doing some complex heavy lifting.
I have a massive ~1000 line materialized view that takes the Postgres JIT about 7 seconds to do its thing, while the execution itself (on a small table, anyway) is maybe a half second. Since I need to refresh the views in my test suite, I just set
JIT = off
globally in the test environment, but it would be nice if there was a built-in option to disable it for the view only.If I write it, would this be a welcome change?