Resistant starch can alter the intestinal nutrient availability and bulk of digesta, thereby modulating the substrate available for microbial metabolic activity along the gastrointestinal tract. This study elucidated the effect of transglycosylated starch (TGS) on the retention of digesta in the upper digestive tract, ileal flow and hindgut disappearance of nutrients, and subsequent bacterial profiles in pigs. Fourteen ileal-cannulated growing pigs were fed either the TGS or control (CON) diet in a complete crossover design. Each period consisted of a 10-day adaptation to the diets, followed by 3-day collection of faeces and ileal digesta. Consumption of TGS decreased the retention of digesta in the stomach and small intestine and increased the ileal dry matter, starch, calcium and phosphorous flow, leading to enhanced starch fermentation in the hindgut compared to CON-fed pigs. The TGS increased ileal and faecal total short-chain fatty acids, especially ileal and faecal acetate and faecal butyrate. Gastric retention time positively correlated to Klebsiella, which benefited together with Selenomonas, Lactobacillus, Mitsuokella and Coriobacteriaceae from TGS feeding and ileal starch flow. Similar relationships existed in faeces with Coriobacteriaceae, Veillonellaceae and Megasphaera benefiting most, either directly or indirectly via crossfeeding, from TGS residuals in faeces. The TGS, in turn, depressed genera within Ruminococcaceae, Clostridiales and Christensenellaceae compared to the CON diet. Present results demonstrated distinct ileal and faecal bacterial community and metabolite profiles in CON- and TGS-fed pigs, which were modulated by the type of starch, intestinal substrate flow and retention of digesta in the upper digestive tract.