Projections on category vs joining by $et

Hi,

Can I ask, In a projections which is most efficient to use out of these two examples?

fromStreams([

“$et-ProcessStepsCounted”,

“$et-ProcessStarted”,

“$et-ProcessStepStarted”,

“$et-OptionalProcessStepStarted”,

“$et-ProcessStepCompleted”,

“$et-ProcessCompleted”,

“$et-ProcessFailed”,

“$et-ProcessWarned”,

“$et-AllProcessStepsStarted”

]).when({

‘$any’: function (s, e) {

outputToStreams(e);

}

});

or

fromCategory(‘process’)

.when({

‘ProcessStepsCounted’: function (s, e) {

outputToStreams(e);

},

‘ProcessStarted’: function (s, e) {

outputToStreams(e);

},

‘ProcessStepStarted’: function (s, e) {

outputToStreams(e);

},

‘OptionalProcessStepStarted’: function (s, e) {

outputToStreams(e);

},

‘ProcessStepCompleted’: function (s, e) {

outputToStreams(e);

},

‘ProcessCompleted’: function (s, e) {

outputToStreams(e);

},

‘ProcessFailed’: function (s, e) {

outputToStreams(e);

},

‘ProcessWarned’: function (s, e) {

outputToStreams(e);

},

‘AllProcessStepsStarted’: function (s, e) {

outputToStreams(e);

}

});

Thanks

The first should be but as always “it depends”.

Are you using the $et events for other things? If not using them means that you can turn of the byeventtype projection then the second is definitely better.

Should we be turning off the by event type projection then If we don’t need it?

Always turn off projections if you know you will never use them. They only take up resources (both on the cpu/memory and make the database larger) and can also increase the startup time of projections when a node failover occurs.