5

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).

1 Answer 1

3

In the FROM clause below, the subquery acts as a table:

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.

2
  • So... "inlining the view as a subquery" would have been the pedantic way of putting it? ;)
    – Opux
    Commented Jun 30, 2016 at 13:42
  • Yes, "inlining the view as a subquery" is one way of putting it. Commented Jun 30, 2016 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.