The solution to this dilemma is to design the tables so that one entry can match multiple addresses. The most common way to achieve this is to assign addresses in a hierarchical fashion, so that addresses physically close together share a common address prefix.
Hierarchical addressing schemes are not unique to Internet IP addresses. Both the telephone company and the postal service use hierachical schemes to manage large numbers of addresses.
A telephone switch in California isn't configured with the location of every telephone in Virginia. Instead, the switch in California knows only that all telephone numbers beginning with area code 703 should be sent to Virginia. The Virginia switches know that numbers beginning with 703 555 all originate from a given switch. That particular telephone switch is configured with the precise line to use for 703 555-1212.
Likewise, a postman in Los Angeles doesn't need to know the location of every zip code in the country. Any zip code beginning with 2 is somewhere on the other side of the country. The L.A. postman only needs to know the exact locations of zip codes beginning with 902 - his particular postal region.
What is unique about IP addresses is their use of a binary, rather than a decimal hierarchy. This should not come as much of a surprise, but reemphasizes the need for a good grasp of binary numbering.