John Wood | 5 Jul 2005 17:06

nested loops and performance

Hi Sedna team,

 

I have a question about your implementation of xquery and performance.

 

If I have a nested for loop such as:

 

for $book in $input/books

for $publisher in $input/publishers

where $book/name=$publisher/name and $book/inPrint = “yes”

return …

 

Is this going to iterate every publisher for every book and then test to see if the condition “$book/inPrint=”yes”” holds? Or will it only go through the publishers of books that meet that criteria?

I ask because I see this as quite an important performance issue.

 

Any insight will be welcome… hope you understand what I mean.

 

Thanks,

John

 

Dmitry Lizorkin | 7 Jul 2005 09:06
Picon

Re: nested loops and performance

Hi John!
 
Such logical optimizations as changing the order/place of conditional filterings are not currently implemented in Sedna. That is, query execution in your example involves checking the condition for every tuple book-publisher.
 
Indeed, our team has a long experience of query optimization based on rewriting. However, we temporary accept the policy of _not_ automatically rewriting things that can be easily rewritten manually during query authoring. We do understand that cases like the one you discussed in your
e-mail are very important for performance, but they currently have the lower priority in our ToDo list.
 
Recently, we started an activity of join recognition/optimization in Sedna, and this would obviously result in providing optimizations to the filtering conditions you mentioned. If this is an important issue for you, we will inform you about our progress.
 
Dmitry
Sedna team
 
----- Original Message -----
From: John Wood
Sent: Tuesday, July 05, 2005 7:06 PM
Subject: [Sedna-discussion] nested loops and performance

Hi Sedna team,

 

I have a question about your implementation of xquery and performance.

 

If I have a nested for loop such as:

 

for $book in $input/books

for $publisher in $input/publishers

where $book/name=$publisher/name and $book/inPrint = “yes”

return …

 

Is this going to iterate every publisher for every book and then test to see if the condition “$book/inPrint=”yes”” holds? Or will it only go through the publishers of books that meet that criteria?

I ask because I see this as quite an important performance issue.

 

Any insight will be welcome… hope you understand what I mean.

 

Thanks,

John

 

Dan Huizenga | 11 Jul 2005 15:21
Picon

XQuery User Input?

Is there any way to get user input in xquery?  Something as simple as
access to an environment variable, or the ability to include another
xquery file would be sufficient.

Dmitry Lizorkin | 12 Jul 2005 15:41
Picon

Re: XQuery User Input?

Hi Dan!
If we understand your question correctly, Sedna doesn't currently provide
the functionality you asked for. Could you describe in a more detail what
you need Sedna to support?

Dmitry,
Sedna team

----- Original Message -----
From: "Dan Huizenga" <danhuizenga@...>
To: <sedna-discussion@...>
Sent: Monday, July 11, 2005 5:21 PM
Subject: [Sedna-discussion] XQuery User Input?

> Is there any way to get user input in xquery?  Something as simple as
> access to an environment variable, or the ability to include another
> xquery file would be sufficient.
>

Violeta Dulugea | 14 Jul 2005 20:11
Picon
Favicon

XQuery - order by Clause

Hi Sedna Team,
 
I would like to know if Sedna supports the XQuery FLWOR expression. I would like to get the result ordered by an attribute value and I got the following error
 
XQuery parser syntax error
Details: unexpected token: 'order' , line 3
 
How can I get the result from an XQuery ordered ascending or descending?
 
Thank you.
 
Violeta

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Dmitry Lizorkin | 15 Jul 2005 13:28
Picon

Re: XQuery - order by Clause

Hi Violeta!
 
Currently, the "order by" clause of the FLWOR-expression is not supported in Sedna.
 
However, if you want to get the result ordered by an attribute value, you can use the following XQuery query as an example:
 
(: Lower-level function :)
declare function local:insert_in_proper_position(
  $e as node(), $seq as node()*, $attr_name as xs:string) as node()* {
 if( empty($seq) )
 then $e
 else
 if( $e/ <at> *[name(.) eq $attr_name] < $seq[position()=1]/ <at> *[name(.) eq $attr_name] )
 then ($e, $seq)
 else ($seq[position()=1],
       local:insert_in_proper_position($e, $seq[position() > 1], $attr_name))
};
 
(: Sorts a sequence $seq in the ascending order of attribute that has the
 name $attr_name :)
declare function local:sort_by_attr($seq as node()*, $attr_name as xs:string)
  as node()* {
 if( empty($seq) )   (: Empty is sorted :)
 then ()
 else
  local:insert_in_proper_position(
   $seq[position()=1],
   local:sort_by_attr($seq[position() > 1], $attr_name),
   $attr_name)
};

(: Sort result in the ascending order of the attribute "a" :)
local:sort_by_attr(
 for $n in (8, 5, 3, 1, 9)
 return
  <elem>{attribute {"a"} {$n},
         "text"}</elem>,
 "a"
)
 
The above XQuery query returns the following reordered sequence:
 
<elem a="1">text</elem>
<elem a="3">text</elem>
<elem a="5">text</elem>
<elem a="8">text</elem>
<elem a="9">text</elem>
If you need the result sorted in descending order, you can apply the local:reverse function to a sequence afterwards:
 
declare function local:reverse($s as item()*) as item()* {
 if (empty($s)) then ()
 else ( local:reverse($s[position()>1]), $s[position()=1] )
};
 
Hope this helps you.
 
Dmitry,
Sedna team
 

----- Original Message -----
Sent: Thursday, July 14, 2005 10:11 PM
Subject: [Sedna-discussion] XQuery - order by Clause

Hi Sedna Team,
 
I would like to know if Sedna supports the XQuery FLWOR expression. I would like to get the result ordered by an attribute value and I got the following error
 
XQuery parser syntax error
Details: unexpected token: 'order' , line 3
 
How can I get the result from an XQuery ordered ascending or descending?
 
Thank you.
 
Violeta

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Dmitry Lizorkin | 18 Jul 2005 09:34
Picon

Re: XQuery - order by Clause

Hi Violeta
 
You can find a list with what is supported is Sedna in "Sedna Programmer's Guide", section 2, available online at:
 
In the end of this summer, we are planning to give much attention to join optimizations, which are closely related to sequence ordering and the "order by" clause in particular. We suppose to have the "order by" clause of the FLWOR expression implemented as one of the results of these activities. You can expect the "order by" clause implemented by early autumn.
 
Best regards,
Dmitry
 
----- Original Message -----
Sent: Saturday, July 16, 2005 8:14 PM
Subject: Re: [Sedna-discussion] XQuery - order by Clause

Hi Dmitry
 
Thank you for answering me. Your functions are working great for me. I would like to know if there is a list with what is supported in Sedna. And I would like to know if you have a plan to add the support for "order by"  clause of the FLWOR expression.
Thank you.
 
Best Regards,
Violeta
 
Bertucci, Eve | 18 Jul 2005 10:32
Favicon

Bulk load in collection problem

Hello Sedna team,
 
I am using the C API on linux. I would like to load an xml file in a collection, and so I tried to execute the following command :
LOAD "audio_rss_sample.xml" "audio_document" "RSS"
through the function SEexecute.
The function never terminates, the execution was blocked and no error message was displayed. I think the context was Ok  (collection RSS was created ...)
I also tried it in command line, and it got blocked too.
Is this functionality actually supported ?
My goal is to be able to write requests and updates addressed to a group of documents and according to your ProgGuide I have to use collections. 
If the bulk load in collection is not supported, what could I use instead ?
 
Thanks for your answer
Regards
 
Eve
Dmitry Lizorkin | 19 Jul 2005 13:51
Picon

Re: Bulk load in collection problem

Hello Eve,
 
You applied everything correctly, and the functionality you described is actually supported.
 
We reproduced the actions you described, and you helped us to find a bug in the implementation of Sedna collections. We fixed this bug today, and you can download the new Sedna build here:
 
Also, since database recovery is not yet implemented in Sedna, it is strongly desirable that you re-create your database.
 
Sorry for inconvenience.
And thank you a lot for the bug report.
 
Dmitry,
Sedna team
 
----- Original Message -----
Sent: Monday, July 18, 2005 12:32 PM
Subject: [Sedna-discussion] Bulk load in collection problem

Hello Sedna team,
 
I am using the C API on linux. I would like to load an xml file in a collection, and so I tried to execute the following command :
LOAD "audio_rss_sample.xml" "audio_document" "RSS"
through the function SEexecute.
The function never terminates, the execution was blocked and no error message was displayed. I think the context was Ok  (collection RSS was created ...)
I also tried it in command line, and it got blocked too.
Is this functionality actually supported ?
My goal is to be able to write requests and updates addressed to a group of documents and according to your ProgGuide I have to use collections. 
If the bulk load in collection is not supported, what could I use instead ?
 
Thanks for your answer
Regards
 
Eve
Siver Andrey | 20 Jul 2005 11:50
Picon
Picon

"trn <defunct>" problem

Hello, Sedna team,
 
We use Sedna 0.4.59 (under Linux) with Sedna Apache module 1.2 and every time after successful execution of XQuery servlet "trn <defunct>" appears in processes list (after running `ps' command). Is it ok?
 
 
 
Best regards,
 
Andrey

Gmane