Why is one database faster than the other?

I have 2 databases with 1 collection and the same documents, this databases run in localhost. The documents in the different databases differ only in their structure.

Example of Structure 1

{"_id":{"$oid":"5f8ffa19a46b9d4179eaf943"},"Nome":"Eduino Dykstra","Data nascita":"March 4, 1980","Nazionalità":"Togo","Ruolo":"FW","Link calciatore":"https://fbref.com/en/players/vjLRENdD/Eduino-Dykstra","Stagioni":[{"season":"2006-2007","age":{"$numberInt":"27"},"squad":"Atlas","country":"mx MEX","comp_level":"1. Liga MX","lg_finish":"18th","games":{"$numberInt":"2"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"32"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0.52"},"npxg":{"$numberDouble":"0.52"},"xa":{"$numberDouble":"0.58"},"xg_per90":{"$numberDouble":"0"},"xa_per90":{"$numberDouble":"0"},"xg_xa_per90":{"$numberDouble":"0"},"npxg_per90":{"$numberDouble":"0"},"npxg_xa_per90":{"$numberDouble":"0"}},{"season":"2007-2008","age":{"$numberInt":"28"},"squad":"Puebla","country":"mx MEX","comp_level":"1. Liga MX","lg_finish":"8th","games":{"$numberInt":"0"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"0"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0"},"npxg":{"$numberDouble":"0"},"xa":{"$numberDouble":"0.81"},"xg_per90":{"$numberDouble":"0"},"xa_per90":{"$numberDouble":"0"},"xg_xa_per90":{"$numberDouble":"0"},"npxg_per90":{"$numberDouble":"0"},"npxg_xa_per90":{"$numberDouble":"0"}},{"season":"2008-2009","age":{"$numberInt":"29"},"squad":"Villarreal","country":"es ESP","comp_level":"1. La Liga","lg_finish":"5th","games":{"$numberInt":"3"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"98"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0.08"},"npxg":{"$numberDouble":"0.08"},"xa":{"$numberDouble":"0.97"},"xg_per90":{"$numberDouble":"0.08"},"xa_per90":{"$numberDouble":"0.97"},"xg_xa_per90":{"$numberDouble":"1.05"},"npxg_per90":{"$numberDouble":"0.08"},"npxg_xa_per90":{"$numberDouble":"1.05"}},{"season":"2009-2010","age":{"$numberInt":"30"},"squad":"Nantes","country":"fr FRA","comp_level":"1. Ligue 1","lg_finish":"13th","games":{"$numberInt":"21"},"games_starts":{"$numberInt":"20"},"minutes":{"$numberInt":"1040"},"goals":{"$numberInt":"13"},"assists":{"$numberInt":"2"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.18"},"assists_per90":{"$numberDouble":"0.18"},"goals_assists_per90":{"$numberDouble":"1.35"},"goals_pens_per90":{"$numberDouble":"1.18"},"goals_assists_pens_per90":{"$numberDouble":"1.36"},"xg":{"$numberDouble":"10.4"},"npxg":{"$numberDouble":"10.4"},"xa":{"$numberDouble":"0.72"},"xg_per90":{"$numberDouble":"0.94"},"xa_per90":{"$numberDouble":"0.06"},"xg_xa_per90":{"$numberDouble":"1"},"npxg_per90":{"$numberDouble":"0.94"},"npxg_xa_per90":{"$numberDouble":"1"}},{"season":"2010-2011","age":{"$numberInt":"31"},"squad":"FC Khimki","country":"ru RUS","comp_level":"1. Russian Premier League","lg_finish":"15th","games":{"$numberInt":"27"},"games_starts":{"$numberInt":"2"},"minutes":{"$numberInt":"570"},"goals":{"$numberInt":"10"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"1"},"pens_att":{"$numberInt":"2"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"1"},"goals_per90":{"$numberDouble":"1.66"},"assists_per90":{"$numberDouble":"0.16"},"goals_assists_per90":{"$numberDouble":"1.81"},"goals_pens_per90":{"$numberDouble":"1.5"},"goals_assists_pens_per90":{"$numberDouble":"1.66"},"xg":{"$numberDouble":"9.41"},"npxg":{"$numberDouble":"7.37"},"xa":{"$numberDouble":"0.91"},"xg_per90":{"$numberDouble":"1.56"},"xa_per90":{"$numberDouble":"0.15"},"xg_xa_per90":{"$numberDouble":"1.71"},"npxg_per90":{"$numberDouble":"1.22"},"npxg_xa_per90":{"$numberDouble":"1.36"}},{"season":"2011-2012","age":{"$numberInt":"32"},"squad":"Cagliari","country":"it ITA","comp_level":"1. Serie A","lg_finish":"14th","games":{"$numberInt":"6"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"186"},"goals":{"$numberInt":"1"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.5"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0.5"},"goals_pens_per90":{"$numberDouble":"0.5"},"goals_assists_pens_per90":{"$numberDouble":"0.5"},"xg":{"$numberDouble":"0.43"},"npxg":{"$numberDouble":"0.43"},"xa":{"$numberDouble":"0.54"},"xg_per90":{"$numberDouble":"0.21"},"xa_per90":{"$numberDouble":"0.27"},"xg_xa_per90":{"$numberDouble":"0.48"},"npxg_per90":{"$numberDouble":"0.21"},"npxg_xa_per90":{"$numberDouble":"0.48"}},{"season":"2012-2013","age":{"$numberInt":"33"},"squad":"Defensa y Just","country":"ar ARG","comp_level":"1. Primera Div","lg_finish":"6th","games":{"$numberInt":"5"},"games_starts":{"$numberInt":"2"},"minutes":{"$numberInt":"220"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.5"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"1.5"},"goals_pens_per90":{"$numberDouble":"1.5"},"goals_assists_pens_per90":{"$numberDouble":"1.5"},"xg":{"$numberDouble":"1.53"},"npxg":{"$numberDouble":"1.53"},"xa":{"$numberDouble":"0.38"},"xg_per90":{"$numberDouble":"0.76"},"xa_per90":{"$numberDouble":"0.19"},"xg_xa_per90":{"$numberDouble":"0.95"},"npxg_per90":{"$numberDouble":"0.76"},"npxg_xa_per90":{"$numberDouble":"0.95"}},{"season":"2013-2014","age":{"$numberInt":"34"},"squad":"Emmen","country":"nl NED","comp_level":"1. Dutch Eredivisie","lg_finish":"12th","games":{"$numberInt":"14"},"games_starts":{"$numberInt":"12"},"minutes":{"$numberInt":"963"},"goals":{"$numberInt":"5"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.5"},"assists_per90":{"$numberDouble":"0.1"},"goals_assists_per90":{"$numberDouble":"0.6"},"goals_pens_per90":{"$numberDouble":"0.5"},"goals_assists_pens_per90":{"$numberDouble":"0.6"},"xg":{"$numberDouble":"5.32"},"npxg":{"$numberDouble":"5.32"},"xa":{"$numberDouble":"1.09"},"xg_per90":{"$numberDouble":"0.53"},"xa_per90":{"$numberDouble":"0.1"},"xg_xa_per90":{"$numberDouble":"0.63"},"npxg_per90":{"$numberDouble":"0.53"},"npxg_xa_per90":{"$numberDouble":"0.63"}},{"season":"2014-2015","age":{"$numberInt":"35"},"squad":"Munchen Gladbach","country":"de GER","comp_level":"1. Bundesliga","lg_finish":"4th","games":{"$numberInt":"33"},"games_starts":{"$numberInt":"6"},"minutes":{"$numberInt":"967"},"goals":{"$numberInt":"18"},"assists":{"$numberInt":"3"},"pens_made":{"$numberInt":"4"},"pens_att":{"$numberInt":"6"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.8"},"assists_per90":{"$numberDouble":"0.3"},"goals_assists_per90":{"$numberDouble":"2.1"},"goals_pens_per90":{"$numberDouble":"1.4"},"goals_assists_pens_per90":{"$numberDouble":"1.7"},"xg":{"$numberDouble":"16.2"},"npxg":{"$numberDouble":"13"},"xa":{"$numberDouble":"2.54"},"xg_per90":{"$numberDouble":"1.61"},"xa_per90":{"$numberDouble":"0.25"},"xg_xa_per90":{"$numberDouble":"1.86"},"npxg_per90":{"$numberDouble":"1.3"},"npxg_xa_per90":{"$numberDouble":"1.55"}},{"season":"2015-2016","age":{"$numberInt":"36"},"squad":"Schalke 04","country":"de GER","comp_level":"1. Bundesliga","lg_finish":"12th","games":{"$numberInt":"22"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"667"},"goals":{"$numberInt":"6"},"assists":{"$numberInt":"3"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"1"},"goals_per90":{"$numberDouble":"0.85"},"assists_per90":{"$numberDouble":"0.42"},"goals_assists_per90":{"$numberDouble":"1.27"},"goals_pens_per90":{"$numberDouble":"0.85"},"goals_assists_pens_per90":{"$numberDouble":"1.28"},"xg":{"$numberDouble":"1.26"},"npxg":{"$numberDouble":"1.26"},"xa":{"$numberDouble":"1.71"},"xg_per90":{"$numberDouble":"0.18"},"xa_per90":{"$numberDouble":"0.24"},"xg_xa_per90":{"$numberDouble":"0.42"},"npxg_per90":{"$numberDouble":"0.18"},"npxg_xa_per90":{"$numberDouble":"0.42"}},{"season":"2016-2017","age":{"$numberInt":"37"},"squad":"Sheffield Utd","country":"eng ENG","comp_level":"1. Premier League","lg_finish":"9th","games":{"$numberInt":"5"},"games_starts":{"$numberInt":"3"},"minutes":{"$numberInt":"271"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"1"},"goals_pens_per90":{"$numberDouble":"1"},"goals_assists_pens_per90":{"$numberDouble":"1"},"xg":{"$numberDouble":"1.04"},"npxg":{"$numberDouble":"1.04"},"xa":{"$numberDouble":"0.6"},"xg_per90":{"$numberDouble":"0.34"},"xa_per90":{"$numberDouble":"0.19"},"xg_xa_per90":{"$numberDouble":"0.53"},"npxg_per90":{"$numberDouble":"0.34"},"npxg_xa_per90":{"$numberDouble":"0.53"}},{"season":"2017-2018","age":{"$numberInt":"38"},"squad":"Utrecht","country":"nl NED","comp_level":"1. Dutch Eredivisie","lg_finish":"6th","games":{"$numberInt":"34"},"games_starts":{"$numberInt":"3"},"minutes":{"$numberInt":"872"},"goals":{"$numberInt":"14"},"assists":{"$numberInt":"2"},"pens_made":{"$numberInt":"4"},"pens_att":{"$numberInt":"6"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"2"},"goals_per90":{"$numberDouble":"1.55"},"assists_per90":{"$numberDouble":"0.22"},"goals_assists_per90":{"$numberDouble":"1.77"},"goals_pens_per90":{"$numberDouble":"1.11"},"goals_assists_pens_per90":{"$numberDouble":"1.33"},"xg":{"$numberDouble":"13.1"},"npxg":{"$numberDouble":"9.09"},"xa":{"$numberDouble":"2.05"},"xg_per90":{"$numberDouble":"1.45"},"xa_per90":{"$numberDouble":"0.22"},"xg_xa_per90":{"$numberDouble":"1.67"},"npxg_per90":{"$numberDouble":"1.01"},"npxg_xa_per90":{"$numberDouble":"1.23"}},{"season":"2018-2019","age":{"$numberInt":"39"},"squad":"Alavés","country":"es ESP","comp_level":"1. La Liga","lg_finish":"16th","games":{"$numberInt":"14"},"games_starts":{"$numberInt":"1"},"minutes":{"$numberInt":"445"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"4"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.75"},"assists_per90":{"$numberDouble":"1"},"goals_assists_per90":{"$numberDouble":"1.75"},"goals_pens_per90":{"$numberDouble":"0.75"},"goals_assists_pens_per90":{"$numberDouble":"1.75"},"xg":{"$numberDouble":"1.39"},"npxg":{"$numberDouble":"1.39"},"xa":{"$numberDouble":"0.21"},"xg_per90":{"$numberDouble":"0.34"},"xa_per90":{"$numberDouble":"0.05"},"xg_xa_per90":{"$numberDouble":"0.39"},"npxg_per90":{"$numberDouble":"0.34"},"npxg_xa_per90":{"$numberDouble":"0.39"}},{"season":"2019-2020","age":{"$numberInt":"40"},"squad":"Defensa y Just","country":"ar ARG","comp_level":"1. Primera Div","lg_finish":"6th","games":{"$numberInt":"17"},"games_starts":{"$numberInt":"6"},"minutes":{"$numberInt":"761"},"goals":{"$numberInt":"10"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.25"},"assists_per90":{"$numberDouble":"0.12"},"goals_assists_per90":{"$numberDouble":"1.37"},"goals_pens_per90":{"$numberDouble":"1.25"},"goals_assists_pens_per90":{"$numberDouble":"1.37"},"xg":{"$numberDouble":"8.54"},"npxg":{"$numberDouble":"8.54"},"xa":{"$numberDouble":"0.18"},"xg_per90":{"$numberDouble":"1.06"},"xa_per90":{"$numberDouble":"0.02"},"xg_xa_per90":{"$numberDouble":"1.08"},"npxg_per90":{"$numberDouble":"1.06"},"npxg_xa_per90":{"$numberDouble":"1.08"}}]}

Example of Structure 2:

{"_id":{"$oid":"5f8ffa19a46b9d4179eafd2c"},"Nome":"Eduino Dykstra","Data nascita":"March 4, 1980","Nazionalità":"Togo","Ruolo":"FW","Link calciatore":"https://fbref.com/en/players/vjLRENdD/Eduino-Dykstra","Ultima stagione":{"season":"2019-2020","age":{"$numberInt":"40"},"squad":"Defensa y Just","country":"ar ARG","comp_level":"1. Primera Div","lg_finish":"6th","games":{"$numberInt":"17"},"games_starts":{"$numberInt":"6"},"minutes":{"$numberInt":"761"},"goals":{"$numberInt":"10"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.25"},"assists_per90":{"$numberDouble":"0.12"},"goals_assists_per90":{"$numberDouble":"1.37"},"goals_pens_per90":{"$numberDouble":"1.25"},"goals_assists_pens_per90":{"$numberDouble":"1.37"},"xg":{"$numberDouble":"8.54"},"npxg":{"$numberDouble":"8.54"},"xa":{"$numberDouble":"0.18"},"xg_per90":{"$numberDouble":"1.06"},"xa_per90":{"$numberDouble":"0.02"},"xg_xa_per90":{"$numberDouble":"1.08"},"npxg_per90":{"$numberDouble":"1.06"},"npxg_xa_per90":{"$numberDouble":"1.08"}},"Penultima stagione":{"season":"2018-2019","age":{"$numberInt":"39"},"squad":"Alavés","country":"es ESP","comp_level":"1. La Liga","lg_finish":"16th","games":{"$numberInt":"14"},"games_starts":{"$numberInt":"1"},"minutes":{"$numberInt":"445"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"4"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.75"},"assists_per90":{"$numberDouble":"1"},"goals_assists_per90":{"$numberDouble":"1.75"},"goals_pens_per90":{"$numberDouble":"0.75"},"goals_assists_pens_per90":{"$numberDouble":"1.75"},"xg":{"$numberDouble":"1.39"},"npxg":{"$numberDouble":"1.39"},"xa":{"$numberDouble":"0.21"},"xg_per90":{"$numberDouble":"0.34"},"xa_per90":{"$numberDouble":"0.05"},"xg_xa_per90":{"$numberDouble":"0.39"},"npxg_per90":{"$numberDouble":"0.34"},"npxg_xa_per90":{"$numberDouble":"0.39"}},"Stagioni":[{"season":"2006-2007","age":{"$numberInt":"27"},"squad":"Atlas","country":"mx MEX","comp_level":"1. Liga MX","lg_finish":"18th","games":{"$numberInt":"2"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"32"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0.52"},"npxg":{"$numberDouble":"0.52"},"xa":{"$numberDouble":"0.58"},"xg_per90":{"$numberDouble":"0"},"xa_per90":{"$numberDouble":"0"},"xg_xa_per90":{"$numberDouble":"0"},"npxg_per90":{"$numberDouble":"0"},"npxg_xa_per90":{"$numberDouble":"0"}},{"season":"2007-2008","age":{"$numberInt":"28"},"squad":"Puebla","country":"mx MEX","comp_level":"1. Liga MX","lg_finish":"8th","games":{"$numberInt":"0"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"0"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0"},"npxg":{"$numberDouble":"0"},"xa":{"$numberDouble":"0.81"},"xg_per90":{"$numberDouble":"0"},"xa_per90":{"$numberDouble":"0"},"xg_xa_per90":{"$numberDouble":"0"},"npxg_per90":{"$numberDouble":"0"},"npxg_xa_per90":{"$numberDouble":"0"}},{"season":"2008-2009","age":{"$numberInt":"29"},"squad":"Villarreal","country":"es ESP","comp_level":"1. La Liga","lg_finish":"5th","games":{"$numberInt":"3"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"98"},"goals":{"$numberInt":"0"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0"},"goals_pens_per90":{"$numberDouble":"0"},"goals_assists_pens_per90":{"$numberDouble":"0"},"xg":{"$numberDouble":"0.08"},"npxg":{"$numberDouble":"0.08"},"xa":{"$numberDouble":"0.97"},"xg_per90":{"$numberDouble":"0.08"},"xa_per90":{"$numberDouble":"0.97"},"xg_xa_per90":{"$numberDouble":"1.05"},"npxg_per90":{"$numberDouble":"0.08"},"npxg_xa_per90":{"$numberDouble":"1.05"}},{"season":"2009-2010","age":{"$numberInt":"30"},"squad":"Nantes","country":"fr FRA","comp_level":"1. Ligue 1","lg_finish":"13th","games":{"$numberInt":"21"},"games_starts":{"$numberInt":"20"},"minutes":{"$numberInt":"1040"},"goals":{"$numberInt":"13"},"assists":{"$numberInt":"2"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.18"},"assists_per90":{"$numberDouble":"0.18"},"goals_assists_per90":{"$numberDouble":"1.35"},"goals_pens_per90":{"$numberDouble":"1.18"},"goals_assists_pens_per90":{"$numberDouble":"1.36"},"xg":{"$numberDouble":"10.4"},"npxg":{"$numberDouble":"10.4"},"xa":{"$numberDouble":"0.72"},"xg_per90":{"$numberDouble":"0.94"},"xa_per90":{"$numberDouble":"0.06"},"xg_xa_per90":{"$numberDouble":"1"},"npxg_per90":{"$numberDouble":"0.94"},"npxg_xa_per90":{"$numberDouble":"1"}},{"season":"2010-2011","age":{"$numberInt":"31"},"squad":"FC Khimki","country":"ru RUS","comp_level":"1. Russian Premier League","lg_finish":"15th","games":{"$numberInt":"27"},"games_starts":{"$numberInt":"2"},"minutes":{"$numberInt":"570"},"goals":{"$numberInt":"10"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"1"},"pens_att":{"$numberInt":"2"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"1"},"goals_per90":{"$numberDouble":"1.66"},"assists_per90":{"$numberDouble":"0.16"},"goals_assists_per90":{"$numberDouble":"1.81"},"goals_pens_per90":{"$numberDouble":"1.5"},"goals_assists_pens_per90":{"$numberDouble":"1.66"},"xg":{"$numberDouble":"9.41"},"npxg":{"$numberDouble":"7.37"},"xa":{"$numberDouble":"0.91"},"xg_per90":{"$numberDouble":"1.56"},"xa_per90":{"$numberDouble":"0.15"},"xg_xa_per90":{"$numberDouble":"1.71"},"npxg_per90":{"$numberDouble":"1.22"},"npxg_xa_per90":{"$numberDouble":"1.36"}},{"season":"2011-2012","age":{"$numberInt":"32"},"squad":"Cagliari","country":"it ITA","comp_level":"1. Serie A","lg_finish":"14th","games":{"$numberInt":"6"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"186"},"goals":{"$numberInt":"1"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.5"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"0.5"},"goals_pens_per90":{"$numberDouble":"0.5"},"goals_assists_pens_per90":{"$numberDouble":"0.5"},"xg":{"$numberDouble":"0.43"},"npxg":{"$numberDouble":"0.43"},"xa":{"$numberDouble":"0.54"},"xg_per90":{"$numberDouble":"0.21"},"xa_per90":{"$numberDouble":"0.27"},"xg_xa_per90":{"$numberDouble":"0.48"},"npxg_per90":{"$numberDouble":"0.21"},"npxg_xa_per90":{"$numberDouble":"0.48"}},{"season":"2012-2013","age":{"$numberInt":"33"},"squad":"Defensa y Just","country":"ar ARG","comp_level":"1. Primera Div","lg_finish":"6th","games":{"$numberInt":"5"},"games_starts":{"$numberInt":"2"},"minutes":{"$numberInt":"220"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.5"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"1.5"},"goals_pens_per90":{"$numberDouble":"1.5"},"goals_assists_pens_per90":{"$numberDouble":"1.5"},"xg":{"$numberDouble":"1.53"},"npxg":{"$numberDouble":"1.53"},"xa":{"$numberDouble":"0.38"},"xg_per90":{"$numberDouble":"0.76"},"xa_per90":{"$numberDouble":"0.19"},"xg_xa_per90":{"$numberDouble":"0.95"},"npxg_per90":{"$numberDouble":"0.76"},"npxg_xa_per90":{"$numberDouble":"0.95"}},{"season":"2013-2014","age":{"$numberInt":"34"},"squad":"Emmen","country":"nl NED","comp_level":"1. Dutch Eredivisie","lg_finish":"12th","games":{"$numberInt":"14"},"games_starts":{"$numberInt":"12"},"minutes":{"$numberInt":"963"},"goals":{"$numberInt":"5"},"assists":{"$numberInt":"1"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"0.5"},"assists_per90":{"$numberDouble":"0.1"},"goals_assists_per90":{"$numberDouble":"0.6"},"goals_pens_per90":{"$numberDouble":"0.5"},"goals_assists_pens_per90":{"$numberDouble":"0.6"},"xg":{"$numberDouble":"5.32"},"npxg":{"$numberDouble":"5.32"},"xa":{"$numberDouble":"1.09"},"xg_per90":{"$numberDouble":"0.53"},"xa_per90":{"$numberDouble":"0.1"},"xg_xa_per90":{"$numberDouble":"0.63"},"npxg_per90":{"$numberDouble":"0.53"},"npxg_xa_per90":{"$numberDouble":"0.63"}},{"season":"2014-2015","age":{"$numberInt":"35"},"squad":"Munchen Gladbach","country":"de GER","comp_level":"1. Bundesliga","lg_finish":"4th","games":{"$numberInt":"33"},"games_starts":{"$numberInt":"6"},"minutes":{"$numberInt":"967"},"goals":{"$numberInt":"18"},"assists":{"$numberInt":"3"},"pens_made":{"$numberInt":"4"},"pens_att":{"$numberInt":"6"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1.8"},"assists_per90":{"$numberDouble":"0.3"},"goals_assists_per90":{"$numberDouble":"2.1"},"goals_pens_per90":{"$numberDouble":"1.4"},"goals_assists_pens_per90":{"$numberDouble":"1.7"},"xg":{"$numberDouble":"16.2"},"npxg":{"$numberDouble":"13"},"xa":{"$numberDouble":"2.54"},"xg_per90":{"$numberDouble":"1.61"},"xa_per90":{"$numberDouble":"0.25"},"xg_xa_per90":{"$numberDouble":"1.86"},"npxg_per90":{"$numberDouble":"1.3"},"npxg_xa_per90":{"$numberDouble":"1.55"}},{"season":"2015-2016","age":{"$numberInt":"36"},"squad":"Schalke 04","country":"de GER","comp_level":"1. Bundesliga","lg_finish":"12th","games":{"$numberInt":"22"},"games_starts":{"$numberInt":"0"},"minutes":{"$numberInt":"667"},"goals":{"$numberInt":"6"},"assists":{"$numberInt":"3"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"1"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"1"},"goals_per90":{"$numberDouble":"0.85"},"assists_per90":{"$numberDouble":"0.42"},"goals_assists_per90":{"$numberDouble":"1.27"},"goals_pens_per90":{"$numberDouble":"0.85"},"goals_assists_pens_per90":{"$numberDouble":"1.28"},"xg":{"$numberDouble":"1.26"},"npxg":{"$numberDouble":"1.26"},"xa":{"$numberDouble":"1.71"},"xg_per90":{"$numberDouble":"0.18"},"xa_per90":{"$numberDouble":"0.24"},"xg_xa_per90":{"$numberDouble":"0.42"},"npxg_per90":{"$numberDouble":"0.18"},"npxg_xa_per90":{"$numberDouble":"0.42"}},{"season":"2016-2017","age":{"$numberInt":"37"},"squad":"Sheffield Utd","country":"eng ENG","comp_level":"1. Premier League","lg_finish":"9th","games":{"$numberInt":"5"},"games_starts":{"$numberInt":"3"},"minutes":{"$numberInt":"271"},"goals":{"$numberInt":"3"},"assists":{"$numberInt":"0"},"pens_made":{"$numberInt":"0"},"pens_att":{"$numberInt":"0"},"cards_yellow":{"$numberInt":"0"},"cards_red":{"$numberInt":"0"},"goals_per90":{"$numberDouble":"1"},"assists_per90":{"$numberDouble":"0"},"goals_assists_per90":{"$numberDouble":"1"},"goals_pens_per90":{"$numberDouble":"1"},"goals_assists_pens_per90":{"$numberDouble":"1"},"xg":{"$numberDouble":"1.04"},"npxg":{"$numberDouble":"1.04"},"xa":{"$numberDouble":"0.6"},"xg_per90":{"$numberDouble":"0.34"},"xa_per90":{"$numberDouble":"0.19"},"xg_xa_per90":{"$numberDouble":"0.53"},"npxg_per90":{"$numberDouble":"0.34"},"npxg_xa_per90":{"$numberDouble":"0.53"}},{"season":"2017-2018","age":{"$numberInt":"38"},"squad":"Utrecht","country":"nl NED","comp_level":"1. Dutch Eredivisie","lg_finish":"6th","games":{"$numberInt":"34"},"games_starts":{"$numberInt":"3"},"minutes":{"$numberInt":"872"},"goals":{"$numberInt":"14"},"assists":{"$numberInt":"2"},"pens_made":{"$numberInt":"4"},"pens_att":{"$numberInt":"6"},"cards_yellow":{"$numberInt":"1"},"cards_red":{"$numberInt":"2"},"goals_per90":{"$numberDouble":"1.55"},"assists_per90":{"$numberDouble":"0.22"},"goals_assists_per90":{"$numberDouble":"1.77"},"goals_pens_per90":{"$numberDouble":"1.11"},"goals_assists_pens_per90":{"$numberDouble":"1.33"},"xg":{"$numberDouble":"13.1"},"npxg":{"$numberDouble":"9.09"},"xa":{"$numberDouble":"2.05"},"xg_per90":{"$numberDouble":"1.45"},"xa_per90":{"$numberDouble":"0.22"},"xg_xa_per90":{"$numberDouble":"1.67"},"npxg_per90":{"$numberDouble":"1.01"},"npxg_xa_per90":{"$numberDouble":"1.23"}}]}

On these databases I perform the same operations and calculate the times through an application written in Java. The queries aren’t optimized and that’s not what I’m interested in right now.
But for example, why in a classic find operation performed through “Link calciatore” for both cases, the operation on the database with structure 2 is faster than the operation on the database with structure 1 ??
What affects performance in this case? Structure?

Hi @Andrea_Langone,

Can you post the tested queries and their explain plan and evidence of the execution time?

Also can you provide collection.stats() output from both.

Best regards,
Pavel

Stats of Structure 1:

 {
    "ns" : "FootballStats.Calciatori",
    "size" : 2519591,
    "count" : 500,
    "avgObjSize" : 5039,
    "storageSize" : 745472,
    "capped" : false,
    "wiredTiger" : {
            "metadata" : {
                    "formatVersion" : 1
            },
            "creationString" : "access_pattern_hint=none,allocation_size=4KB,app_metadata=(formatVersion=1),assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none),block_allocation=best,block_compressor=snappy,cache_resident=false,checksum=on,colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,name=),exclusive=false,extractor=,format=btree,huffman_key=,huffman_value=,ignore_in_memory_cache_size=false,immutable=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=q,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=64MB,log=(enabled=true),lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_custom=(prefix=,start_generation=0,suffix=),merge_max=15,merge_min=0),memory_page_image_max=0,memory_page_max=10m,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,source=,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,type=file,value_format=u",
            "type" : "file",
            "uri" : "statistics:table:collection-42--2967289990190938292",
            "LSM" : {
                    "bloom filter false positives" : 0,
                    "bloom filter hits" : 0,
                    "bloom filter misses" : 0,
                    "bloom filter pages evicted from cache" : 0,
                    "bloom filter pages read into cache" : 0,
                    "bloom filters in the LSM tree" : 0,
                    "chunks in the LSM tree" : 0,
                    "highest merge generation in the LSM tree" : 0,
                    "queries that could have benefited from a Bloom filter that did not exist" : 0,
                    "sleep for LSM checkpoint throttle" : 0,
                    "sleep for LSM merge throttle" : 0,
                    "total size of bloom filters" : 0
            },
            "block-manager" : {
                    "allocations requiring file extension" : 25,
                    "blocks allocated" : 25,
                    "blocks freed" : 0,
                    "checkpoint size" : 729088,
                    "file allocation unit size" : 4096,
                    "file bytes available for reuse" : 0,
                    "file magic number" : 120897,
                    "file major version number" : 1,
                    "file size in bytes" : 745472,
                    "minor version number" : 0
            },
            "btree" : {
                    "btree checkpoint generation" : 6,
                    "column-store fixed-size leaf pages" : 0,
                    "column-store internal pages" : 0,
                    "column-store variable-size RLE encoded values" : 0,
                    "column-store variable-size deleted values" : 0,
                    "column-store variable-size leaf pages" : 0,
                    "fixed-record size" : 0,
                    "maximum internal page key size" : 368,
                    "maximum internal page size" : 4096,
                    "maximum leaf page key size" : 2867,
                    "maximum leaf page size" : 32768,
                    "maximum leaf page value size" : 67108864,
                    "maximum tree depth" : 3,
                    "number of key/value pairs" : 0,
                    "overflow pages" : 0,
                    "pages rewritten by compaction" : 0,
                    "row-store empty values" : 0,
                    "row-store internal pages" : 0,
                    "row-store leaf pages" : 0
            },
            "cache" : {
                    "bytes currently in the cache" : 2766556,
                    "bytes dirty in the cache cumulative" : 908,
                    "bytes read into cache" : 0,
                    "bytes written from cache" : 2523802,
                    "checkpoint blocked page eviction" : 0,
                    "data source pages selected for eviction unable to be evicted" : 0,
                    "eviction walk passes of a file" : 0,
                    "eviction walk target pages histogram - 0-9" : 0,
                    "eviction walk target pages histogram - 10-31" : 0,
                    "eviction walk target pages histogram - 128 and higher" : 0,
                    "eviction walk target pages histogram - 32-63" : 0,
                    "eviction walk target pages histogram - 64-128" : 0,
                    "eviction walks abandoned" : 0,
                    "eviction walks gave up because they restarted their walk twice" : 0,
                    "eviction walks gave up because they saw too many pages and found no candidates" : 0,
                    "eviction walks gave up because they saw too many pages and found too few candidates" : 0,
                    "eviction walks reached end of tree" : 0,
                    "eviction walks started from root of tree" : 0,
                    "eviction walks started from saved location in tree" : 0,
                    "hazard pointer blocked page eviction" : 0,
                    "in-memory page passed criteria to be split" : 0,
                    "in-memory page splits" : 0,
                    "internal pages evicted" : 0,
                    "internal pages split during eviction" : 0,
                    "leaf pages split during eviction" : 0,
                    "modified pages evicted" : 0,
                    "overflow pages read into cache" : 0,
                    "page split during eviction deepened the tree" : 0,
                    "page written requiring cache overflow records" : 0,
                    "pages read into cache" : 0,
                    "pages read into cache after truncate" : 1,
                    "pages read into cache after truncate in prepare state" : 0,
                    "pages read into cache requiring cache overflow entries" : 0,
                    "pages requested from the cache" : 2500,
                    "pages seen by eviction walk" : 0,
                    "pages written from cache" : 23,
                    "pages written requiring in-memory restoration" : 0,
                    "tracked dirty bytes in the cache" : 0,
                    "unmodified pages evicted" : 0
            },
            "cache_walk" : {
                    "Average difference between current eviction generation when the page was last considered" : 0,
                    "Average on-disk page image size seen" : 0,
                    "Average time in cache for pages that have been visited by the eviction server" : 0,
                    "Average time in cache for pages that have not been visited by the eviction server" : 0,
                    "Clean pages currently in cache" : 0,
                    "Current eviction generation" : 0,
                    "Dirty pages currently in cache" : 0,
                    "Entries in the root page" : 0,
                    "Internal pages currently in cache" : 0,
                    "Leaf pages currently in cache" : 0,
                    "Maximum difference between current eviction generation when the page was last considered" : 0,
                    "Maximum page size seen" : 0,
                    "Minimum on-disk page image size seen" : 0,
                    "Number of pages never visited by eviction server" : 0,
                    "On-disk page image sizes smaller than a single allocation unit" : 0,
                    "Pages created in memory and never written" : 0,
                    "Pages currently queued for eviction" : 0,
                    "Pages that could not be queued for eviction" : 0,
                    "Refs skipped during cache traversal" : 0,
                    "Size of the root page" : 0,
                    "Total number of pages currently in cache" : 0
            },
            "compression" : {
                    "compressed page maximum internal page size prior to compression" : 4096,
                    "compressed page maximum leaf page size prior to compression " : 121244,
                    "compressed pages read" : 0,
                    "compressed pages written" : 22,
                    "page written failed to compress" : 0,
                    "page written was too small to compress" : 1
            },
            "cursor" : {
                    "bulk loaded cursor insert calls" : 0,
                    "cache cursors reuse count" : 999,
                    "close calls that result in cache" : 0,
                    "create calls" : 2,
                    "insert calls" : 500,
                    "insert key and value bytes" : 2520528,
                    "modify" : 0,
                    "modify key and value bytes affected" : 0,
                    "modify value bytes modified" : 0,
                    "next calls" : 250500,
                    "open cursor count" : 0,
                    "operation restarted" : 0,
                    "prev calls" : 1,
                    "remove calls" : 0,
                    "remove key bytes removed" : 0,
                    "reserve calls" : 0,
                    "reset calls" : 3502,
                    "search calls" : 0,
                    "search near calls" : 1500,
                    "truncate calls" : 0,
                    "update calls" : 0,
                    "update key and value bytes" : 0,
                    "update value size change" : 0
            },
            "reconciliation" : {
                    "dictionary matches" : 0,
                    "fast-path pages deleted" : 0,
                    "internal page key bytes discarded using suffix compression" : 43,
                    "internal page multi-block writes" : 0,
                    "internal-page overflow keys" : 0,
                    "leaf page key bytes discarded using prefix compression" : 0,
                    "leaf page multi-block writes" : 1,
                    "leaf-page overflow keys" : 0,
                    "maximum blocks required for a page" : 1,
                    "overflow values written" : 0,
                    "page checksum matches" : 0,
                    "page reconciliation calls" : 2,
                    "page reconciliation calls for eviction" : 0,
                    "pages deleted" : 0
            },
            "session" : {
                    "object compaction" : 0
            },
            "transaction" : {
                    "update conflicts" : 0
            }
    },
    "nindexes" : 1,
    "indexBuilds" : [ ],
    "totalIndexSize" : 20480,
    "indexSizes" : {
            "_id_" : 20480
    },
    "scaleFactor" : 1,
    "ok" : 1

}

Stats of Structure 2:

 {
    "ns" : "FootballStats_2.Calciatori",
    "size" : 2535188,
    "count" : 500,
    "avgObjSize" : 5070,
    "storageSize" : 737280,
    "capped" : false,
    "wiredTiger" : {
            "metadata" : {
                    "formatVersion" : 1
            },
            "creationString" : "access_pattern_hint=none,allocation_size=4KB,app_metadata=(formatVersion=1),assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none),block_allocation=best,block_compressor=snappy,cache_resident=false,checksum=on,colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,name=),exclusive=false,extractor=,format=btree,huffman_key=,huffman_value=,ignore_in_memory_cache_size=false,immutable=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=q,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=64MB,log=(enabled=true),lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_custom=(prefix=,start_generation=0,suffix=),merge_max=15,merge_min=0),memory_page_image_max=0,memory_page_max=10m,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,source=,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,type=file,value_format=u",
            "type" : "file",
            "uri" : "statistics:table:collection-44--2967289990190938292",
            "LSM" : {
                    "bloom filter false positives" : 0,
                    "bloom filter hits" : 0,
                    "bloom filter misses" : 0,
                    "bloom filter pages evicted from cache" : 0,
                    "bloom filter pages read into cache" : 0,
                    "bloom filters in the LSM tree" : 0,
                    "chunks in the LSM tree" : 0,
                    "highest merge generation in the LSM tree" : 0,
                    "queries that could have benefited from a Bloom filter that did not exist" : 0,
                    "sleep for LSM checkpoint throttle" : 0,
                    "sleep for LSM merge throttle" : 0,
                    "total size of bloom filters" : 0
            },
            "block-manager" : {
                    "allocations requiring file extension" : 25,
                    "blocks allocated" : 25,
                    "blocks freed" : 0,
                    "checkpoint size" : 720896,
                    "file allocation unit size" : 4096,
                    "file bytes available for reuse" : 0,
                    "file magic number" : 120897,
                    "file major version number" : 1,
                    "file size in bytes" : 737280,
                    "minor version number" : 0
            },
            "btree" : {
                    "btree checkpoint generation" : 8,
                    "column-store fixed-size leaf pages" : 0,
                    "column-store internal pages" : 0,
                    "column-store variable-size RLE encoded values" : 0,
                    "column-store variable-size deleted values" : 0,
                    "column-store variable-size leaf pages" : 0,
                    "fixed-record size" : 0,
                    "maximum internal page key size" : 368,
                    "maximum internal page size" : 4096,
                    "maximum leaf page key size" : 2867,
                    "maximum leaf page size" : 32768,
                    "maximum leaf page value size" : 67108864,
                    "maximum tree depth" : 3,
                    "number of key/value pairs" : 0,
                    "overflow pages" : 0,
                    "pages rewritten by compaction" : 0,
                    "row-store empty values" : 0,
                    "row-store internal pages" : 0,
                    "row-store leaf pages" : 0
            },
            "cache" : {
                    "bytes currently in the cache" : 2783499,
                    "bytes dirty in the cache cumulative" : 908,
                    "bytes read into cache" : 0,
                    "bytes written from cache" : 2539399,
                    "checkpoint blocked page eviction" : 0,
                    "data source pages selected for eviction unable to be evicted" : 0,
                    "eviction walk passes of a file" : 0,
                    "eviction walk target pages histogram - 0-9" : 0,
                    "eviction walk target pages histogram - 10-31" : 0,
                    "eviction walk target pages histogram - 128 and higher" : 0,
                    "eviction walk target pages histogram - 32-63" : 0,
                    "eviction walk target pages histogram - 64-128" : 0,
                    "eviction walks abandoned" : 0,
                    "eviction walks gave up because they restarted their walk twice" : 0,
                    "eviction walks gave up because they saw too many pages and found no candidates" : 0,
                    "eviction walks gave up because they saw too many pages and found too few candidates" : 0,
                    "eviction walks reached end of tree" : 0,
                    "eviction walks started from root of tree" : 0,
                    "eviction walks started from saved location in tree" : 0,
                    "hazard pointer blocked page eviction" : 0,
                    "in-memory page passed criteria to be split" : 0,
                    "in-memory page splits" : 0,
                    "internal pages evicted" : 0,
                    "internal pages split during eviction" : 0,
                    "leaf pages split during eviction" : 0,
                    "modified pages evicted" : 0,
                    "overflow pages read into cache" : 0,
                    "page split during eviction deepened the tree" : 0,
                    "page written requiring cache overflow records" : 0,
                    "pages read into cache" : 0,
                    "pages read into cache after truncate" : 1,
                    "pages read into cache after truncate in prepare state" : 0,
                    "pages read into cache requiring cache overflow entries" : 0,
                    "pages requested from the cache" : 2500,
                    "pages seen by eviction walk" : 0,
                    "pages written from cache" : 23,
                    "pages written requiring in-memory restoration" : 0,
                    "tracked dirty bytes in the cache" : 0,
                    "unmodified pages evicted" : 0
            },
            "cache_walk" : {
                    "Average difference between current eviction generation when the page was last considered" : 0,
                    "Average on-disk page image size seen" : 0,
                    "Average time in cache for pages that have been visited by the eviction server" : 0,
                    "Average time in cache for pages that have not been visited by the eviction server" : 0,
                    "Clean pages currently in cache" : 0,
                    "Current eviction generation" : 0,
                    "Dirty pages currently in cache" : 0,
                    "Entries in the root page" : 0,
                    "Internal pages currently in cache" : 0,
                    "Leaf pages currently in cache" : 0,
                    "Maximum difference between current eviction generation when the page was last considered" : 0,
                    "Maximum page size seen" : 0,
                    "Minimum on-disk page image size seen" : 0,
                    "Number of pages never visited by eviction server" : 0,
                    "On-disk page image sizes smaller than a single allocation unit" : 0,
                    "Pages created in memory and never written" : 0,
                    "Pages currently queued for eviction" : 0,
                    "Pages that could not be queued for eviction" : 0,
                    "Refs skipped during cache traversal" : 0,
                    "Size of the root page" : 0,
                    "Total number of pages currently in cache" : 0
            },
            "compression" : {
                    "compressed page maximum internal page size prior to compression" : 4096,
                    "compressed page maximum leaf page size prior to compression " : 127796,
                    "compressed pages read" : 0,
                    "compressed pages written" : 22,
                    "page written failed to compress" : 0,
                    "page written was too small to compress" : 1
            },
            "cursor" : {
                    "bulk loaded cursor insert calls" : 0,
                    "cache cursors reuse count" : 998,
                    "close calls that result in cache" : 0,
                    "create calls" : 3,
                    "insert calls" : 500,
                    "insert key and value bytes" : 2536125,
                    "modify" : 0,
                    "modify key and value bytes affected" : 0,
                    "modify value bytes modified" : 0,
                    "next calls" : 250500,
                    "open cursor count" : 0,
                    "operation restarted" : 0,
                    "prev calls" : 1,
                    "remove calls" : 0,
                    "remove key bytes removed" : 0,
                    "reserve calls" : 0,
                    "reset calls" : 3502,
                    "search calls" : 0,
                    "search near calls" : 1500,
                    "truncate calls" : 0,
                    "update calls" : 0,
                    "update key and value bytes" : 0,
                    "update value size change" : 0
            },
            "reconciliation" : {
                    "dictionary matches" : 0,
                    "fast-path pages deleted" : 0,
                    "internal page key bytes discarded using suffix compression" : 43,
                    "internal page multi-block writes" : 0,
                    "internal-page overflow keys" : 0,
                    "leaf page key bytes discarded using prefix compression" : 0,
                    "leaf page multi-block writes" : 1,
                    "leaf-page overflow keys" : 0,
                    "maximum blocks required for a page" : 1,
                    "overflow values written" : 0,
                    "page checksum matches" : 0,
                    "page reconciliation calls" : 2,
                    "page reconciliation calls for eviction" : 0,
                    "pages deleted" : 0
            },
            "session" : {
                    "object compaction" : 0
            },
            "transaction" : {
                    "update conflicts" : 0
            }
    },
    "nindexes" : 1,
    "indexBuilds" : [ ],
    "totalIndexSize" : 20480,
    "indexSizes" : {
            "_id_" : 20480
    },
    "scaleFactor" : 1,
    "ok" : 1

}

Query tested for both:

db.collection.find({"Link calciatore": value })

**Execution time of 500 finds: **
Structure 1: 418.10612000000003 ms
Structure 2: 411.49282000000005 ms

Explain Structure 1:

{
    "queryPlanner" : {
            "plannerVersion" : 1,
            "namespace" : "FootballStats.Calciatori",
            "indexFilterSet" : false,
            "parsedQuery" : {
                    "Link calciatore" : {
                            "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                    }
            },
            "winningPlan" : {
                    "stage" : "COLLSCAN",
                    "filter" : {
                            "Link calciatore" : {
                                    "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                            }
                    },
                    "direction" : "forward"
            },
            "rejectedPlans" : [ ]
    },
    "executionStats" : {
            "executionSuccess" : true,
            "nReturned" : 1,
            "executionTimeMillis" : 2,
            "totalKeysExamined" : 0,
            "totalDocsExamined" : 500,
            "executionStages" : {
                    "stage" : "COLLSCAN",
                    "filter" : {
                            "Link calciatore" : {
                                    "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                            }
                    },
                    "nReturned" : 1,
                    "executionTimeMillisEstimate" : 0,
                    "works" : 502,
                    "advanced" : 1,
                    "needTime" : 500,
                    "needYield" : 0,
                    "saveState" : 3,
                    "restoreState" : 3,
                    "isEOF" : 1,
                    "direction" : "forward",
                    "docsExamined" : 500
            }
    },
    "serverInfo" : {
            "host" : "LAPTOP-UKM9G3CG",
            "port" : 27017,
            "version" : "4.2.3",
            "gitVersion" : "6874650b362138df74be53d366bbefc321ea32d4"
    },
    "ok" : 1

}

Explain Structure 2:

 {
    "queryPlanner" : {
            "plannerVersion" : 1,
            "namespace" : "FootballStats_2.Calciatori",
            "indexFilterSet" : false,
            "parsedQuery" : {
                    "Link calciatore" : {
                            "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                    }
            },
            "winningPlan" : {
                    "stage" : "COLLSCAN",
                    "filter" : {
                            "Link calciatore" : {
                                    "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                            }
                    },
                    "direction" : "forward"
            },
            "rejectedPlans" : [ ]
    },
    "executionStats" : {
            "executionSuccess" : true,
            "nReturned" : 1,
            "executionTimeMillis" : 0,
            "totalKeysExamined" : 0,
            "totalDocsExamined" : 500,
            "executionStages" : {
                    "stage" : "COLLSCAN",
                    "filter" : {
                            "Link calciatore" : {
                                    "$eq" : "https://fbref.com/en/players/ohHqST5T/Vea-Pete"
                            }
                    },
                    "nReturned" : 1,
                    "executionTimeMillisEstimate" : 0,
                    "works" : 502,
                    "advanced" : 1,
                    "needTime" : 500,
                    "needYield" : 0,
                    "saveState" : 3,
                    "restoreState" : 3,
                    "isEOF" : 1,
                    "direction" : "forward",
                    "docsExamined" : 500
            }
    },
    "serverInfo" : {
            "host" : "LAPTOP-UKM9G3CG",
            "port" : 27017,
            "version" : "4.2.3",
            "gitVersion" : "6874650b362138df74be53d366bbefc321ea32d4"
    },
    "ok" : 1

}

Hi @Andrea_Langone,

The difference is 8ms for a full collection scan to return 1 doc.

This could be from verious reason which can be hard to find.

One of them is that on disk collection 1 take more space (by a small amount) since you don’t use and index, which you must, scan 2 can be potentially a bit faster.

I wouldn’t investigate this difference any further and suggest to compare indexed executions.

Best
Pavel

3 Likes

I had a similar question raised. Please check if you can help here as well: MongoDB: Queries running twice slow on NEW server compared to OLD server.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.