Performance Problems in join and count()!!

I have 2 schemes in tamino 4.2, both have 230.000 documents, when attempt to execute a XQuery with a join between this schemes wich have a 9300 doc of result the XQuery it takes 0.125 seg :smiley: , wich is ok but when attempt to do the same XQuery with count() it takes 23 seg :shock: wich is very very bad!!! what is the problem with count() an joins? is this a bug of Tamino 4.2 ?? :?:

these are the XQuerys:

1.
for $a in input()/Paciente
where (($a/DatosPersonales/ApellidoPat=‘GONZALEZ’ or $a/DatosPersonales/ApellidoPat=‘PEREZ’ or $a/DatosPersonales/ApellidoPat=‘LOPEZ’) and (for $b in input()/Paciente2 where $a/DatosPersonales/Run=$b/DatosPersonales/Run return ))
return $a
0.125 seg in get the result :smiley: .

2.
count(for $a in input()/Paciente
where (($a/DatosPersonales/ApellidoPat=‘GONZALEZ’ or $a/DatosPersonales/ApellidoPat=‘PEREZ’ or $a/DatosPersonales/ApellidoPat=‘LOPEZ’) and (for $b in input()/Paciente2 where $a/DatosPersonales/Run=$b/DatosPersonales/Run return ))
return $a)
23 seg :shock: :cry: :?:

if is the same XQuery with only the count() diference then what is problem with Tamino?

Thanks!!!
Paciente.tsd (17.6 KB)

Hi,

I’ve tried to load your schema. But I wasn’t successful. I think I also need the schema that defines the “Comuna” collection.

Best Regards,

Thorsten

these are the schemes
“Paciente”,“Comuna”
thanks.
Tschemas.zip (2.42 KB)

Hi,

The provided schemas do not define any Paciente2 doctype, to reproduce the problem I also need this schema.
I’ve done some testing by removing the “2” from the Paciente2 doctype name, but the explain output of the modified queries didn’t show any difference that could explain the big difference in the execution time. So, in addition to the complete set of involved schemas I would like to have the explain output of the two queries.

Thanks and regards,

Thorsten Fiebig

Hi, these are three schemas “Paciente”,“Paciente2” and “Comuna”, the only difference between “Paciente2” and “Paciente” if the name of the root node both schemas have the same structure. and the same data.

a lot of thanks.
taminoschemas.zip (3.65 KB)

Hi,

When I’m comparing the explain output for both queries compiled against the schemas I don’t see any big difference. It would be really helpful if you could send me your explain output.

Best Regards,

Thorsten Fiebig