# Calculate usage patterns and data volume in New Relic

> Sample queries to understand data volume of spans, metrics and transactions in New Relic

Source: https://last9.io/docs/how-to-calculate-usage-patterns-and-data-volume-in-newrelic/

This document lists queries which you can run in your New Relic and share with Last9 as process of migration from New Relic to Last9.

## Calculating Data in New Relic

This following NRQL queries will calculate calculate total no. of transactions, spans and mertics
over the last day.

1. Total no. of spans over a week

```sql
SELECT count(*) FROM Span SINCE 1 week ago
```

2. Total transactions

```sql
SELECT count(*) FROM Transaction SINCE 1 week ago
```

```sql
SELECT count(*) FROM Transaction FACET dateOf(timestamp) SINCE 1 week ago TIMESERIES 1 day
```

3. Total Metrics

```sql
SELECT count(*) FROM Metric SINCE 1 week ago
```

4.Total Event

```sql
SELECT count(*) FROM Event SINCE 1 week ago
```

5. Total Logs

```sql
SELECT count(*) FROM Log SINCE 1 week ago
```

Additionally, you can share how much data is getting ingested in New Relic from the data management tab.
