14 - Server-side Logic Execution / User-defined Functions (CMU Advanced Databases / Spring 2023)

preview_player
Показать описание

15-721 Advanced Database Systems (Spring 2023)
Carnegie Mellon University
Рекомендации по теме
Комментарии
Автор

Super wholesome to let Sam finish up like that :)

StasPakhomov-wjnn
Автор

The last part of the lecture is a very nice motivation for the next lectures about query optimizers

thomasziereis
Автор

1:00:00 Just wanted to point out that "call?" is not a constant string value that is being passed around, but the name of the first colum of the CTE. Its value is 'false' if the base case of the recursion is reached, and 'true' in the recursive case.

What makes this stuff so hard to read IMHO is that the SELECT comes before the WHERE which is the other way around from the `if` in the original code.
Maybe it is easier to read if you swap their order (which is no longer valid SQL but fast and loose reasoning is morally correct and all that):

(WHERE i1 >= n SELECT (false, 0, 0, 0, 0, p1)) UNION ALL (WHERE i1 < n SELECT (true, i1+1, p1*x, x, n, 0))

w-mcode