We perform a numerical study of the heat transfer and flow structure of Rayleigh-Benard (RB) convection in (in most cases regular) porous media, which are comprised of circular, solid obstacles located on a square lattice. This study is focused on the role of porosity in the flow properties during the transition process from the traditional RB convection with (so no obstacles included) to Darcy-type porous-media convection with approaching 0. Simulations are carried out in a cell with unity aspect ratio, for Rayleigh number from to and varying porosities , at a fixed Prandtl number , and we restrict ourselves to the two-dimensional case. For fixed , the Nusselt number is found to vary non-monotonically as a function of ; namely, with decreasing , it first increases, before it decreases for approaching 0. The non-monotonic behaviour of originates from two competing effects of the porous structure on the heat transfer. On the one hand, the flow coherence is enhanced in the porous media, which is beneficial for the heat transfer. On the other hand, the convection is slowed down by the enhanced resistance due to the porous structure, leading to heat transfer reduction. For fixed , depending on , two different heat transfer regimes are identified, with different effective power-law behaviours of versus , namely a steep one for low when viscosity dominates, and the standard classical one for large . The scaling crossover occurs when the thermal boundary layer thickness and the pore scale are comparable. The influences of the porous structure on the temperature and velocity fluctuations, convective heat flux and energy dissipation rates are analysed, further demonstrating the competing effects of the porous structure to enhance or reduce the heat transfer.