Projection Management - Leaky abstraction?

Just a thought:

It feels a bit messy to me that you have to think about turning projections on and off.

Is it the case that they affect performance so much it’s unavoidable to surface them as a concern?

Otherwise, if I create a projection, I want it to be on - otherwise why did I bother creating it? Conversely, if I don’t want it, why not just delete it?

Am I missing something?

“Is it the case that they affect performance so much it’s unavoidable to surface them as a concern?”

Depends on the projection. Some can be quite expensive. Consider

fromAll().

when({

   $any : function(s,e) {emit('foo', 'type', {bar : 'hello!'}}

})

That will write an event for every event you put in the system.

Consider the built in projections in many systems you don’t want all of them running. They index in ways that are used internally with queries. If you don’t use queries then you may or may not want them running.

Cheers,

Greg

Thanks. I think I need to experiment more with projections to get a good feeling of how they work.

For example, I am thinking it’s not immediately obvious from the docs what the implications are for stopping and starting a continuous projection? Does that mean there’s potentially a “gap” in the emitted events? Or do they “catch up”? What are the performance and consistency implications?

They catch up…

Greg,

Wouldn’t this projection result in infinite recursion loop?

Best,

-Leo

I believe it will fault but haven’t tried in a while. But yes it’s very expensive either way :slight_smile: