Quite a good guess. After some search I found that the origin of the first of the two queries was the Order.php override file from Greenmouse's gmnumeric.
However, the real cause appeared to be a faulty import. There were orders in the database but the auto-increase index was zero.