A genetic study was carried out to: (1) conduct a genetic analysis of longevity of Swedish Yorkshire sows, (2) study the environmental and genetic factors that influence the presence and severity of osteochondrosis, and (3) investigate the relationship between breeding values for osteochondrosis and longevity of sows. The data for the longevity analyses were extracted from the Swedish litter-recording scheme data bank (Quality Genetics, former Scan Avel HB). After editing original data, records of 9814 Yorkshire sows with 7553 (77%) uncensored and 2261 (23%) censored born 1986 through 1997 were used in the analyses. Litter size at first and last farrowing, age at first farrowing, backfat thickness, daily gain and weight at completion of performance test (~170 days) were included as fixed effects in all analyses. The combination of herd-year effect was treated as fixed or random, time-independent or time-dependent in different analyses. Sire effect was considered as the source of genetic variation and thus a sire model was used. The analyses of osteochondrosis were based on information on 14 388 Landrace and 14 458 Yorkshire pigs from the Swedish pig progeny-testing scheme, recorded from 1987 through 1997. The birth herd and the combination of sex, testing station, year and month for start of test were included as fixed effects in the statistical model. Variance and covariance components for osteochondrosis recorded at elbow and knee joints were estimated in a bivariate animal model by the restricted maximum likelihood method within each breed. In the survival analyses (Yorkshire sows), the fixed effects of herd-year (when it was treated as fixed effect), litter size at first and at last farrowing, age at first farrowing, backfat and gain at completion of performance test were highly significant (P < 0·01). Herd-year combination was the major cause of variation for risk of culling, compared with other fixed effects. The risk of being culled at a certain time decreased as the litter size at first and at last farrowing, or backfat of the gilt at completion of performance test increased. With increasing age at first farrowing, the risk of being culled at a certain time increased. Heritability in the original scale for longevity ranged from 0·21 to 0·31. The results for osteochondrosis showed that the combined effect of sex-testing station-year and month of start of test was highly significant (P < 0·01). Estimates of heritabilities for osteochondrosis score were similar for both Landrace and Yorkshire breeds and was, on average, 0·21. The correlations between breeding values for longevity and osteochondrosis were low (on average 0·07, adjusted for genetic trends) but were significant (P < 0·01) and in a favourable direction: higher osteochondrosis load associated with higher risk of being culled.