Cassandra fetch of the most recent object is very slow


#1

Hi,

I’m trying to get the date of the latest measurement with the following query:

var measurement = Measurement.fetch({
        filter: Filter.eq('parent.id', seriesId),
        order: 'descending(start)',
        include: 'start',
        limit: 1
    });

This is very slow on 2 different environments (X-Timing-Info:total=6.633634,cpu=6.61284,io=0.020744, X-Timing-Info:total=4.028602,cpu=4.008811,io=0.019742).

I know I could fetch the latest of the parent series if it is normalized but ideally I’d want the last measurement date even if the series has never been normalized or if normalization is behind.

Is there any way to speed up this query? I’d expect that fetching a single measurement in the reverse persistenceOrder would be almost instantaneous.

Thanks