Previous discussions here concluded that the best was to use clear sheet plastic/lexan on the table edge to prevent minor derailments from turning into major disasters. When my father built my first train table many decades ago, he left room along the edge. But if you are trying to make the most layout in a small space, you need something. When I built my own table, I used 2X3s on the edge. It was safe, but did not look too good, and did take up a few inches. This year I bought some “Hardware Net” from my local hardware store/garden center. The brand name is Landware, but I suppose any would do. It gave me a few more inches all around, and I found I could reverse the 022 switches so the controller hung over the edge. That way you could put turnouts closer together. The net is made of flexible plastic, 1/2" mesh. You can cut it with a scissors. I stapled it in place, leaving about 3 1/2" above the surface. I painted the lower part to match the table.
http://farm3.static.flickr.com/2373/2052966057_773c6de2a1.jpg?v=0