Subject | Question about better performance Query |
---|---|
Author | Olaf Kluge |
Post date | 2012-03-21T15:07:48Z |
Hello,
at this time I have create an statement:
select first 1 a.pfad
from t_pictures a where status <> 6 and
(select count(*) from t_pictures where status < 5 and kd_id = a.kd_id and
li_id = a.li_id) = 0
into :pfad;
pfad = path for an file
Now we have thousands of records in this table and the execution takes some
minutes. How can I make this statement better? I would check If there is for
a record (unique with kd_id and li_id (primary key reference) one record
with status < 5. If no, I can delete the folder then there is no now no
picture in it.
Thanks for helping.
Best regards.
Olaf
[Non-text portions of this message have been removed]
at this time I have create an statement:
select first 1 a.pfad
from t_pictures a where status <> 6 and
(select count(*) from t_pictures where status < 5 and kd_id = a.kd_id and
li_id = a.li_id) = 0
into :pfad;
pfad = path for an file
Now we have thousands of records in this table and the execution takes some
minutes. How can I make this statement better? I would check If there is for
a record (unique with kd_id and li_id (primary key reference) one record
with status < 5. If no, I can delete the folder then there is no now no
picture in it.
Thanks for helping.
Best regards.
Olaf
[Non-text portions of this message have been removed]