On 17.09.2012 11:48, Juha Heinanen wrote:
Klaus Darilion writes:
I wonder why "expires" is checked at all? Expired contacts will be deleted automatically so the chance to ping expired contacts should be very small.
klaus,
i wondered the same. it would not really hurt much if a small number of expired contacts are binged for vain.
otherwise regarding the query, these two conditions
cflags & 0 = 0 and id % 20 = 0
I guess the first '0' is the nat_flag?
are very inefficient, because an operation is applied to a field before comparison. if nat flag would always be the largest flag, comparison could go like this:
cflags >= "value of last flag"
Not sure if an index would be much faster here. Also the cflags & 0 = 0 should be rather fast.
regards Klaus