The geometric recovery achieved with tamping is affected by several factors, including maintenance history, ballast condition, type of tamping, age and configuration of track components, operational speeds, and human factors. In this paper, data from 2,819 defects of longitudinal levelling are analysed considering 66,892 km of inspections carried out on 19 lines of the Portuguese railway network over 10 years. The influence of infrastructure clusters, defect level, ballast age, degradation rate before tamping, and the still little-studied shape of defects on geometry recovery is firstly investigated by analysing relationships between the raw data (scatterplots). A multiple linear regression model is then developed to predict the defect level after tamping, taking into account both the defect level before tamping and its shape, which is modelled through a proxy parameter. It is concluded that track sections where there are singularities (underpasses, culverts, level crossings, bridges, tunnels and viaducts) usually have much shorter maintenance cycles (median values up to 60% lower). Ballast age and degradation rate before tamping did not prove to have a marked influence on geometry recovery. Although the defect level before tamping is found to be the factor that most conditions geometry recovery, thus corroborating the critical importance of timely intervention, its shape also proves to have a significant influence, giving rise to differences in geometry recovery of up to 20% of the defect level before tamping.