What materials are typically used for inlays and onlays, and how do they affect durability and appearance?

What types of materials are commonly used for dental inlays and onlays, such as gold, porcelain, or composite resins, and how do these materials impact the durability, longevity, and aesthetic appearance of the restoration? Are there specific situations where one material is preferred over another?