AW: [firebird-support] Question about better performance Query

2012-03-23 Thread Olaf Kluge
Hello again, for all users with the same "problem": I have created an update-trigger: AS begin if(new.status = 5) then begin if (not exists (select 1 from t_pictures where status < 5 and kd_id = new.kd_id and li_id = new.li_id)) then update t_pictures set status =

AW: [firebird-support] Question about better performance Query

2012-03-23 Thread Olaf Kluge
Hello, another hint. All table-filds which are read are indicated. Each call of the stored procedure get one result, the pc-program delete the folder and report it to the database (other stored procedure). .until there is no other folder to delete. Thanks. Hello Set, the picture-pa

AW: [firebird-support] Question about better performance Query

2012-03-22 Thread Olaf Kluge
Hello Set, the picture-path can be the status 1 (inserted), status 5 (storage-time has expired and picture can be deleted) and status 6 (release to delete). A NIO-Ray-image will be deleted after 2 month, a IO-ray-image after 72 hours. If all pictures are deleted, I can delete the entire folder

RE: [firebird-support] Question about better performance Query

2012-03-21 Thread Svein Erling Tysvær
>>try: >> >>select first 1 a.pfad >>from t_pictures a where status <> 6 and >>not exists (select 1 from t_pictures where status < 5 and kd_id = a.kd_id >>and li_id = a.li_id) >>into :pfad; >> >>(also first 1 will return just 1 record but it could be any record in the >>set as you have no "order by"

AW: [firebird-support] Question about better performance Query

2012-03-21 Thread Olaf Kluge
Re: [firebird-support] Question about better performance Query try: select first 1 a.pfad from t_pictures a where status <> 6 and not exists (select 1 from t_pictures where status < 5 and kd_id = a.kd_id and li_id = a.li_id) into :pfad; (also first 1 will return just 1 record but it could b

Re: [firebird-support] Question about better performance Query

2012-03-21 Thread Nick Upson
try: select first 1 a.pfad from t_pictures a where status <> 6 and not exists (select 1 from t_pictures where status < 5 and kd_id = a.kd_id and li_id = a.li_id) into :pfad; (also first 1 will return just 1 record but it could be any record in the set as you have no "order by") Nick Upson

[firebird-support] Question about better performance Query

2012-03-21 Thread Olaf Kluge
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 record