In all serious Prolog systems, association lists are available to allow faster than linear access to a collection of elements. These association lists are typically based on balanced trees like AVL trees. There is a public domain library called library(assoc)
that ships with many Prolog systems and provides O(log(N)) operations for inserting, fetching and changing elements to a collection.