<?xml version="1.0" encoding="windows-1252"?>
<node id="929623" title="Re^5: For a better efficiency and speed question!" created="2011-10-04 14:11:26" updated="2011-10-04 14:11:26">
<type id="11">
note</type>
<author id="920017">
pvaldes</author>
<data>
<field name="doctext">
&lt;p&gt;Nothing wrong really, but you ask for efficiency and speed, and anything counts...&lt;/p&gt;

You use: 

&lt;c&gt;AND ((date + 1 YEAR) &lt; (CURRENT_DATE + 240 DAYS))&lt;/c&gt;

&lt;p&gt;Let's see the algoritm. For each record you sum 365 to date and remember this number, then you sum 240 to current date and save this to a new var somewhere in the memory, then you compare both numbers&lt;/p&gt;

I'm suggesting this instead:

&lt;c&gt;AND ((date + 125 DAYS) &lt; CURRENT_DATE)&lt;/c&gt;

&lt;p&gt;Now for each record you sum 125 to date and compare this with current date. You are creating a new var, not two.&lt;/p&gt;

&lt;p&gt;Thus you need less memory and is also a little less demanding operation for the CPU. Nothing to care for when you have a few sums but in this context could suppose one advantage&lt;/p&gt;
</field>
<field name="root_node">
929567</field>
<field name="parent_node">
929601</field>
</data>
</node>
