Question: ```
SELECT SQL_NO_CACHE TIME_FORMAT(ADDTIME(journey.departure
        , SEC_TO_TIME(SUM(link2.elapsed))), '%H:%i') AS departure
FROM journey
JOIN journey_day 
    ON journey_day.journey = journey.code
JOIN pattern 
    ON pattern.code = journey.pattern
JOIN service 
    ON service.code = pattern.service
JOIN link 
    ON link.section = pattern.section 
   AND link.stop = "370023591"
JOIN link link2 
    ON link2.section = pattern.section 
   AND link2.id <= link.id
WHERE journey_day.day = 6
GROUP BY journey.id
ORDER BY journey.departure

```

The above query takes 1-2 seconds to run. I need to reduce this to roughly 100ms. Please note that I understand the `service` table hasn't been used in the query, but that is just to simplify the question.

![enter image description here](https://i.stack.imgur.com/oODnc.png)

Any ideas how I can speed this up? I can see that the link table is using filesort, is this causing the slowness in the query?

Answer: 
As the error tells you R requires at least one of the three options, e.g.,

```
Rserve(args="--no-save")

```
I think you cannot start Rserve from within Rstudio because this does not start R with `--save`, `--no-save`, or `--vanilla`. The solution is to launch R from the command line with the appropriate command line arguments, and start Rserve from that.