The Australian sharemarket retreated from record highs on Tuesday on a sharp sell-off in the mining sector.