sql – Select with subquery to collect previous record

I have a structure of user read records by reference.
According to the data below.

SELECT L.LeituraID, L.UsuarioID, L.Referencia, L.Litura
Of Readings AS L
| ----------- | ----------- | ------------ | --------- |
| ReadingID | UserID | Reference | Reading |
| ----------- | ----------- | ------------ | --------- |
| 1 | 1 | 01/01/2018 | 52 |
| 2 | 2 | 01/01/2018 | 157 |
| 3 | 3 | 01/01/2018 | 73 |
| 4 | 1 | 02/01/2018 | 63 |
| 5 | 2 | 02/01/2018 | 171 |
| 6 | 3 | 02/01/2018 | 89 |
| ----------- | ----------- | ------------ | --------- |

I need to collect the user's reading data for a reference date and calculate the consumption.

To calculate the consumption, it is necessary to have the information from the previous reading.

In the event that an error occurs,

The problem is that this search with the subquery is taking too long.

Is there any way to get this earlier reading in a faster way?

WITH cteLeituras AS (
SELECT
L.LeituraID
, L.UsuarioID
, L.Reference
, L.Lyrics
(
SELECT TOP 1 LA.Lyrics
From Readings AS LA
WHERE LA.UsuarioID = L.UsuarioID AND LA.Referencia <L.Referencia
ORDER BY LA.Reference DESC
) Previous reading
Of Readings AS L
WHERE L.Reference = & # 39; 2018-02-01 & # 39;
), cteLeiturasConsumo AS (
SELECT
L.LeituraID
, L.UsuarioID
, L.Reference
, L.Lyrics
, L.Previous
(L.Litura - L.LeituraAnterior) AS Consumo
FROM cteLeituras AS L
)
| ----------- | ----------- | ------------ | --------- | - --------------- | --------- |
| ReadingID | UserID | Reference | Reading | Previous Reading | Consumption |
| ----------- | ----------- | ------------ | --------- | - --------------- | --------- |
| 4 | 1 | 02/01/2018 | 63 | 52 | 11 |
| 5 | 2 | 02/01/2018 | 171 | 157 | 14 |
| 6 | 3 | 02/01/2018 | 89 | 73 | 16 |
| ----------- | ----------- | ------------ | --------- | - --------------- | --------- |