Ну почему же знают, мне именно так и посоветовали поступить, правда там проблема глубже на саммом деле и еще необходимо чтобы у всех таблиц а одинаковым archive_id были одинаковые границы дат, и еще одно требование: если решили использовать архивирование то архивировать нужно все таблицы заложенные в функционал архивирования, при частичном архивировании трабла не решается, потому как довольно отчетливо виден баг:
Код: Выделить всё
SELECT archive_id,start_date,end_date FROM archives ORDER BY id
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <36> case: start >= per_start && start <= per_end && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <37> case: start >= per_start && start <= per_end && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <38> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <39> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <40> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <41> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <42> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <43> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: archive ID <44> case: start <= per_start && end >= per_end
?Debug : Sep 24 11:01:23 UTM5 DBA: start(1230746400) < r(1251741599) < end(1262282400), adding non-archive table into report
SELECT table_name FROM archives WHERE archive_id='36' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1230746400' AND payment_enter_date<='1230749997' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='37' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1230746400' AND payment_enter_date<='1233428399' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='38' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1233174411' AND payment_enter_date<='1235847599' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='39' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1235845001' AND payment_enter_date<='1238522399' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='40' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1236163083' AND payment_enter_date<='1241114399' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='41' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1240223127' AND payment_enter_date<='1243792799' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='42' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1242206373' AND payment_enter_date<='1246384797' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='43' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1245876875' AND payment_enter_date<='1249063199' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT table_name FROM archives WHERE archive_id='44' AND table_type='7'
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1247235030' AND payment_enter_date<='1251741599' AND account_id='4515' ORDER BY payment_enter_date DESC
SELECT id, payment_incurrency, currency_id, currency_rate, payment_absolute,actual_date, payment_enter_date, method, who_receive, comments_for_user,comments_for_admins, account_id, payment_ext_number FROM payment_transactions WHERE payment_enter_date>='1251741599' AND payment_enter_date<='1262282400' AND account_id='4515' ORDER BY payment_enter_date DESC