Here's my admittedly Low Tech way of doing it.  Since you're willing to add a 
column to the table anyway, why not have two columns updated when you print the 
label?  Have a "IsLabelPrinted" column with a Default of 0.  When you print, 
update the date column with .#NOW and update IsLabelPrinted = 1.   Removes the 
extra overhead of a computed column, which I think would have to compute for 
each row one at a time as it evaluates your Where.
However, I can't answer how much faster that would be since there's only 2 
possible values in the table

Karen


    On Wednesday, June 18, 2025 at 02:31:55 PM CDT, Doug Hamilton 
<[email protected]> wrote:   

 I have an order table with a DateTime column, LabelsPrintedDTS. (DTS = 
DateTimeStamp)
The table has a couple hundred thousand rows.
LabelsPrintedDTS gets updated with .#NOW when labels for specified rows 
are printed.
Labels to be printed are selected WHERE LabelsPrintedDTS IS NULL.

As the table grows between semi-annual data archiving, the search for 
labels to print becomes slower.
I don't think indexing LabelsPrintedDTS column will help because:
1) NULL values aren't indexed (this db is RB 10.5)
2) Indexing this column will bloat RX3, there may be up to 100 duplicate 
LabelsPrintedDTS values.

What about:
Creating a calculated Boolean column, PartLabelsPrintedYN = 
IFNULL(PartLabelsPrintedDTS,0,1).
i.e. If labels have not been printed, the value of PartLabelsPrintedYN 
is 0, if printed, the value is 1.
Then the WHERE clause becomes: WHERE PartLabelsPrintedYN= 0
Would such a Boolean search be faster?

I'd test it but don't think my single-user system would be a fair 
evaluation compared to customer's multi-user system.

I saw a Tip-Of-The-Day article about NULLS and indexing in RB 11 but 
can't find it.
For whatever reason, I didn't think it would help this situation.

TIA,
Doug




-- 
This email has been checked for viruses by Avast antivirus software.
www.avast.com

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/rbase-l/5926b3d5-a5a7-4547-ae52-8ed9ab8448f7%40wi.rr.com.
  

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/rbase-l/220263378.57221.1750275358160%40mail.yahoo.com.

Reply via email to