patternsqlMinor
What's an "inline query"?
Viewed 0 times
inlinequerywhat
Problem
According to the currently accepted answer to this question a partial solution to an efficiency problem was to "inline" the query. I can't tell what that is, I can't ask in comments (too little rep) and Googling 'postgresql inline query' isn't very decisive (some seem to think it's synonymous w/"subquery" but others don't).
Solution
In the FROM clause below, the subquery acts as a table:
That subquery is called an inline view. So in this case you are not directly selecting rows from a table, but from an "inline view".
From your first link it seems that the user created an actual view, which you can do from a query. More information over here: https://www.postgresql.org/docs/9.2/static/sql-createview.html
But it seems that Erwin thinks it might be a better idea, performance wise in that specific case, to "inline the query" from the view. Or in other words, not by first creating a view but use inline views like I did.
Hope this helps.
SELECT * FROM (SELECT id, name FROM users)That subquery is called an inline view. So in this case you are not directly selecting rows from a table, but from an "inline view".
From your first link it seems that the user created an actual view, which you can do from a query. More information over here: https://www.postgresql.org/docs/9.2/static/sql-createview.html
But it seems that Erwin thinks it might be a better idea, performance wise in that specific case, to "inline the query" from the view. Or in other words, not by first creating a view but use inline views like I did.
Hope this helps.
Code Snippets
SELECT * FROM (SELECT id, name FROM users)Context
StackExchange Database Administrators Q#142580, answer score: 3
Revisions (0)
No revisions yet.