Optimise custom post type queries

It’s not clear if you mean 800ms for total page load with assets and network overhead (which is quite good) or for page generation time alone (much less good).

In any case you are making a large mistake of guessing that query is your performance bottleneck. That’s not how performance optimization works.

You need to measure what is happening first and draw any conclusions from that. There are both high level WP tools for that (Laps, Query Monitor, etc) and low level PHP tools (xhprof, blackfire, etc).

Speaking generally it is relatively rare for WP post queries to be easy to optimize. WP mostly uses database as dumb data store and is pretty decent at producing SQL for requests. Your query hardly looks complicated there either.

If you want to push it even further it is often practical to just cache data. Sounds like you are already doing that with Varnish for pages overall, but you can still cache bits and pieces explicitly for reuse to improve general performance. See Transients API.

error code: 523