For example, if we had reason to be concerned about *adversarial* inputs, I think that there is a good chance that our qsort() actually would be problematic to the point of driving us to prefer some generally slower alternative.

That is an interesting point.

Indeed, a database in general often stores user-supplied data, which may happen to be sorted for presentation purpose in an interface. Same thing occured with hashtable algorithms and was/is a way to do DOS attacks on web applications. I'm not sure whether the qsort version discussed here would apply on user-supplied data, though. If so, adding some randomness in the decision process would suffice to counter the adversarial input argument you raised.


Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to