Updating single rows in a materialized view (is this a scenic question)

I suppose I need to mention @derekprior here.

Derek I’ve been enjoying the Bikeshed quite a bit. I have a question about scenic and materialized views that might be of general interest.

Is there a way to refresh just one row of a materialized view that is less costly than generating the entire view table again? I have a database with about a million orders in it, and I’d like to use scenic / materialized views to help speed up some searches, but the developer working on it says the view takes too long to generate.

What is a good approach to this situation, scenic wise? I agree with you that I just grow weary of composing complicated ActiveRecord queries–lets just put the stuff we need to look for in one table and be done with it.

I’m not aware of a way to refresh only a single row. That’s not to say it doesn’t exist, but I don’t think it does. You could use an actual table instead and use database triggers to populate the table appropraitely. Kind of an on-the-fly, row-by-row materialized view…