It estimates the execution cost of each potential access plan based on the statistics data stored in catalog and statistics tables, and selects the one with the lowest cost.
Some information is captured in the database that maintains game persistence; other data is added into the directory that contains his profile or the game statistics database.