CTEs as lookup tables
11–20 of 115 posts
Re: CTEs as lookup tables
#12What does CTE stand for in this context?
Re: CTEs as lookup tables
#13Re: CTEs as lookup tables
#14Fun fact, this can also be more performant, depending on the engine.
Re: CTEs as lookup tables
#15CTEs (common table expressions) are wonderful, they make SQL grokkable and maintainable. But, before some dev goes crazy refactoring all of the SQL in their codebase into maintainable CTEs: always benchmark. CTEs can cause your query planner to optimize incorrectly. In some cases, CTEs can force the query optimizer to choose a plan it otherwise is not choosing and be more performant - perhaps up to a certain point. (…
Re: CTEs as lookup tables
#16Re: CTEs as lookup tables
#17Re: CTEs as lookup tables
#18Why is this better than just joining an actual table that expands the codes?
Re: CTEs as lookup tables
#19Re: CTEs as lookup tables
#20Occasionally, SQL surprises with bits of composability, such as the fact that using VALUES to specify literal tuples can be used with both INSERT and the FROM clause of a SELECT. Is there any reason syntactically the SELECT needs to be required? If you use a VALUES table literal as a subselect, you have to give it column names with an AS clause (see https://www.postgresql.org/docs/current/sql-values.html ). I can ima…
Basically, i could put with: values after the join.