[sr-dev] db version of nat pinger

Juha Heinanen jh at tutpro.com
Mon Sep 17 11:48:00 CEST 2012

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.


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

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"

and an index could be added on cflags.

-- juha

More information about the sr-dev mailing list