Aim: To determine the appropriate size of risk windows in both exposed and unexposed sub-cohorts. Method: Data was taken from a previous study of upper gastrointestinal haemorrhage and perforation. The length of each prescription for NSAIDs was estimated. The risk was calculated for the duration of a prescription plus increments of -30, -25, ..., +115, +120 (i.e. 31 increments). Ten unexposed groups were re-sampled for each increment (stratified for age and sex), using the same lengths of risk window as the exposed group. Mean risks and rate-ratios were calculated (per thousand person-years). Results: The NSAID risk rose from 3·52 at -30 days to a peak of 5·82 at -15 days, and then decreased gradually to 2·83 at +120 days. Unexposed risk was variable for the negative increments, and decreased gradually from 2·16 at +0 days to 1·54 at +120 days. The rate-ratio rose from 1·55 at -30 days to a peak of 2·85 at -5 days, and then decreased to 1·85 at +120 days. Conclusion: Risk windows should be the same as (or slightly less than) the calculated length of a prescription. Lengthy windows should not be used for unexposed comparator groups (the exposed windows may be randomly allocated)