/
vaiforic
/
abd6
Обзор
Документация
Войти
/
vaiforic
/
abd6
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
optimize/optimize_filter.sql
40 строк
937 B
vaiforic-lin-nt
lab4 and lab3
30 май 2026, 05:33
30 май 2026, 05:33
46bc341
Код
Авторство
О чём код?
with a_tmp as ( select status, city, int_attr_1 % 100 as int_mod_100, numeric_attr_1 from public.synthetic_data where extract( year from date_attr_1 ) = 2023 and bool_attr_1 = true ), b_tmp as ( select status, city, text_attr_2, numeric_attr_2 from public.synthetic_data where score_1 between 50 and 90 ), c_tmp as ( select text_attr_2, int_attr_1 % 100 as int_mod_100, score_1 from public.synthetic_data where bool_attr_2 = false ) select a.status, a.city, count(*) as join_rows, avg(a.numeric_attr_1 + b.numeric_attr_2 + c.score_1) as avg_metric from a_tmp as a join b_tmp as b on a.status = b.status and a.city = b.city join c_tmp as c on b.text_attr_2 = c.text_attr_2 and a.int_mod_100 = c.int_mod_100 group by a.status, a.city order by join_rows desc limit 20;