There is some link between Ricci-flatness and reduction of holonomy. For example a Kahler manifold is Ricci-flat if and only if it has at most $SU(n)$ holonomy rather than $U(n)$, and it's apparently [open](https://mathoverflow.net/questions/16818/are-there-ricci-flat-riemannian-manifolds-with-generic-holonomy) to construct a closed, simply-connected Ricci-flat manifold with full $SO(n)$ holonomy. 


On a manifold with an arbitrary affine connection, the Ricci curvature still makes sense. By any chance, does being Ricci-flat imply a reduction of the holonomy? In particular, does it imply that the connection is compatible with some (pseudo-Riemannian) metric (i.e. that the holonomy is contained in some $O(p,q)$)? I'm happy to assume the connection is torsion-free. And I'm really most interested in the *local* holonomy, so assume the manifold is simply-connected if that makes a difference.


(The motivation for this question comes from thinking very naively about general relativity as a pure gauge theory, which I think makes sense in a vacuum at least. Maybe in this case the metric constraint comes for free!)



Holonomy of a Ricci-flat affine connection
The answer depends on the dimension. When $n=2$, Ricci-flatness of a connection implies that it is flat, so, in that case, yes, you get holonomy reduction locally. However, when $n>2$, Ricci-flatness of a torsion-free connection only implies that the (local) holonomy lies in $\mathrm{SL}(n,\mathbb{R})$. You do not generally get any further reduction than that.


**Remark 1:**
While writing down the general torsion-free connection with vanishing Ricci tensor and holonomy $\mathrm{SL}(n,\mathbb{R})$ (for $n>2$) does not appear to be easy, 
it is not hard to construct specific examples: Let $M=\mathbb{R}^n$ have its standard coordinates $x^1,\ldots,x^n$ and, for notational simplicity, assume that the indices are taken modulo $n$, i.e., we have $x^{n+1} = x^1,\ x^{-1} = x^{n-1}$, etc.. Let $E\_i$ be the standard coordinate vector fields on $\mathbb{R}^n$ and consider the connection $\nabla$ defined by setting
$$
\nabla\_{E\_i} E\_i = E\_{i-1}\qquad\text{while}\qquad
\nabla\_{E\_i} E\_j = 0\qquad \text{when $i\not\equiv j\mod n$}.
$$
Then $\nabla$ is torsion-free and its curvature tensor is
$$
R^\nabla = \sum\_{i=1}^n\ E\_{i-1}\otimes \mathrm{d}x^{i+1}\otimes
 \bigl(\mathrm{d}x^{i}\wedge\mathrm{d}x^{i+1}\bigr).
$$
Since $n>2$, one has $\mathrm{Ric}(\nabla) = 0$. The image of the curvature operator in $TM\otimes T^\*M$ is spanned by the (nilpotent) linear transformations
$$
N\_i = E\_{i-1}\otimes \mathrm{d}x^{i+1},
$$
and these span an $n$-dimensional subbundle of $\mathrm{End}(TM)$ whose iterated commutators span the entire Lie algebra ${\frak{sl}}(n,\mathbb{R})$ at every
point. Thus, by the Ambrose-Singer Holonomy Theorem, the holonomy of $\nabla$ is $\mathrm{SL}(n,\mathbb{R})$.


Note that $\nabla$ is translation-invariant, so it is well-defined on the quotient 
$\mathbb{T}^n = \mathbb{R}^n/\mathbb{Z}^n$, a compact torus. Thus, compactness does not obstruct the existence of a Ricci-flat torsion-free connection with full holonomy $\mathrm{SL}(n,\mathbb{R})$.


