Background An efficient diagnostic pathway and early stage diagnosis for cancer patients is widely pursued. This study aims to chart the duration of the diagnostic pathway for patients with symptomatic oesophageal and gastric cancer, to identify factors associated with long duration and to assess the association of duration with tumour stage at diagnosis. Methods This was a retrospective cohort study, using electronic health records of six routine primary care databases covering about 640,000 patients, partly linked to the Netherlands Cancer Registry. Symptomatic patients with oesophageal and gastric cancer (2010–2015) that presented in primary care were included. Duration of four diagnostic intervals was determined: patient interval; first symptoms to primary care consultation, primary care interval; consultation to referral, secondary care interval; referral to diagnosis, and the diagnostic interval; consultation to diagnosis. Characteristics associated with ‘long duration’ (≥P75 duration) were assessed using log-binomial regression. Median durations were stratified for tumour stages. Results Among 312 symptomatic patients with upper gastrointestinal cancer, median durations were: patient interval: 29 days (interquartile interval 15–73), primary care interval: 12 days (interquartile interval 1–43), secondary care interval: 13 days (interquartile interval 6–29) and diagnostic interval: 31 days (11–74). Patient interval duration was comparable for patients with and without alarm symptoms. Absence of cancer-specific alarm symptoms was associated with ‘long duration’ of primary care interval and secondary care interval: relative risk 5.0 (95% confidence interval 2.7–9.1) and 2.1 (95% confidence interval 1.3–3.7), respectively. Median diagnostic interval duration for local stage disease was 51 days (interquartile interval 13–135) versus 27 days (interquartile interval 11–71) for advanced stage ( p = 0.07). Conclusion In the diagnostic pathway of upper gastrointestinal cancers, the longest interval is the patient interval. Reducing time to diagnosis may be achieved by improving patients’ awareness of alarm symptoms and by diagnostic strategies which better identify cancer patients despite low suspicion.