If I consider the data your speaking about are points (x,y), you can't use a periodic value to skip points because some of them are more "important" than others. For example, if you have (0,0), (1000,1), (1,1), (3,6), (4,4) and use your idea, it will result in the graph (0,0), (1,1), (4,4) which is obviously not realistic!
What you can do is choose a deltaX and deltaY tolerances such that each points in your graph have at most this tolerance. It doesn't certify that you'll get a maximum of 500 points but it will reduce the concentration of points. Now the question is: how do we choose a good delta? Maybe taking the average deltas is a good solution, you should make some tries.
Can you tell me how do you store your polylines in your DB? (id, x, y, previous_id) ?