Zodbconvert incredibly slow [solved]

When I check the current SQL statement that is running on the database server, it is always this:

SELECT
    zoid,
    tid,
    prev_tid,
    current_object_state.state
FROM
    temp_store
        JOIN current_object_state
            USING (zoid)
WHERE (tid <> prev_tid)

If I call this manually it needs round about 35 seconds and returns an empty list. It is not clear to me what it does. But it does this for every transaction if sure will take a while. I could imagine that there are some indexes or foreign keys missing or something like that. I will try to find a ways to make it faster.

I also tried it with RelStorage in Version 3.4 but the speed has not changed.