Flows into commodity investments have hit their highest levels since the global financial crisis as negative interest rates boost the appeal of real assets, but they risk reversing as rallies falter in metals and oil.

The threat of investors liquidating their commodity stakes has climbed in recent years as speculative funds have become dominant and longer-term investors increasingly shun the sector.

Some $51 billion has moved into commodities investments in the first seven months of the year, the most since 2009, according to Barclays, which tracks the flows.

Investors scrambled to take advantage of this year's rebound in many markets after the 19-commodity Thomson Reuters/Core Commodity CRB Index .TRJCRBTR had more than halved since 2011.

Commodity prices had been sliding for several years as growth faltered in top consumer China while at the same time oversupply hit oil, metals and other products.

The price index peaked this year in June up 11 percent, but has since shed much of those gains. Last year it slid 23 percent.

"Much of the demand for commodities this year has been tactical and, unless the asset class continues to generate strong returns in the second half, which we think unlikely, then outflows could resume," said Kevin Norrish, head of commodities research at Barclays.

Part of the concern is that the surge of cash has come more from investors happy to move in and out of markets rather than pension portfolio managers looking for long-term placements.

"There's been a general paring back in longer term strategic positioning by many of the large pension funds and other longer-term investors," Norrish added.

Last year, the sector won investment inflows of $39.5 billion in the first half, only to shed $45.9 billion in the second half to end the year with $6.3 billion in net outflows.

"September should be a time for seasonal weakness in commodity markets," said Aakash Doshi at Citi, which also tracks commodity investment flows.

"With commodity prices likely to trade sideways or even a bit weaker short term, ongoing passive index outflows... might be in play for September," he said in a note.

The price of Brent crude has surged over 80 percent since touching a 12-year low in late January, but has struggled to reach fresh highs recently.

Investor shift

The type of investors putting cash into commodities has shifted since the boom years when the sector was touted as a way to diversify long-term portfolios, adding an inflation hedge and gaining exposure to high-growth emerging markets.

At the time, pension funds and other long-term investors rushed to buy exposure to the sector through swaps on commodity indexes, covering oil, agriculture and metals in one stroke.

Many of them became disenchanted when the sector not only underperformed but also started moving in tandem with other sectors after the global financial crisis.

Only now, after years of central bank efforts to revive modest inflation by pushing debt yields to negligible or even negative levels, is the investment dynamic starting to change."I've observed a resurgence of interest in all kinds of real assets as opposed to financial assets," said Frances Hudson, Global Thematic Strategist of Multi Asset Investing at Standard Life Investments.

"The renewed interest in commodities has some of the same drivers. Interest rates lower for longer or even negative reduces the opportunity cost of holding commodities."

Standard Life prefers infrastructure, real estate and private equity over commodities, but Hudson regards the sector as "a good short-term parking space" for many investors.

A breakdown of the Barclays data shows how in recent years money deserted index swaps, favored by longer-term investors, and shifted to exchange traded funds (ETFs), largely used by shorter-term speculators and retail investors.

Investors who move in and out of commodity markets find ETPs more flexible, offering individual products such as Brent crude and gold as well as the ability to take bearish positions with short ETPs.

From 2010 to 2012, index swaps had $119.6 billion of inflows with ETPs lagging at $31 billion. But that has flipped: since 2014, there have been $26.8 billion of outflows from index swaps while ETPs drew in $37.9 billion.