I'd like to use an ancient ruin, but deciding how old it might be is tricky. I could just use an arbitrary time in the past, but I want to have a little more science in my science fiction.
Let's look at materials of various ages and how they stand the test of time. We have lots of examples of stone age tools. Most are metal, stone, pottery, or bone and in bad condition from corrosion, but their simple nature makes them easily recognizable thousands of years later. Stone and brick constructions in some climates remain today, but those made from organics are long gone. Middle ages and Rennaisance tools and manuscripts are not rare but are very delicate: brittle and faded. There are homes that are two or three hundred years old all over Europe and a few in northeastern USA. Early Industrial Age tools, vehicles, etc are recognizable but non-functional. Rubber and fabrics decay in decades. Metal frames rust and structures collapse. Modern materials may last longer because of alloys and artificial materials and coatings designed to resist corrosion. However it seems like functionality is even shorter lived now than ever as devices fail and are replaced. Consider a computer or a car. The replacement cycle and failure rates are very high after a few years. Magnetic materials become useless after 5-10 years, optical materials decay anywhere from a year to a decade (depending on whether you get cheap bulk disks or "archival quality" and the environmental conditions).
Now, we're talking about Star Trek. Far future, lots of technological advances. Consider other civilizations of similar technology levels. How long would their world last after they all died? What would remain after 1,000 years? 10,000? 100,000? Millions? A billion? Assuming something around the TNG (mid to late 24th century) era, how long could a civilization have been lost and we could still obtain useful information about their last days? How long would their buildings stand, their computers function, their storage media hold files, their technology (transporters, engines, scanners, etc) work? I'm sure that in the 24th century we're talking about keeping their buildings and structures (ships, bases, etc) from corroding for 10,000 years. Will their power source still run? Will their computers still be solving problems or waiting for input? I doubt both of those, but I'm open to hearing speculation from the group. I think 1,000 years might be pushing either of those, even with automated maintenance. As long as the data crystals or whatever they use don't decay, the information can be retrieved by a visitor with equal technology. But I don't think anything like automated defenses or greeting messages would remain without functioning computers which puts a limitation on how long a dead world might be interesting as a place to explore.