Bird
0
0

Given a table regions with a polygon column and a GiST index on it, what will the query below return?

medium📝 query result Q5 of 15
PostgreSQL - Indexing Strategies
Given a table regions with a polygon column and a GiST index on it, what will the query below return?

SELECT * FROM regions WHERE polygon @> '((2,2),(3,3),(4,2),(2,2))'::polygon;
AAll rows where the polygon contains the specified polygon
BAll rows where the polygon overlaps with the specified polygon
CAll rows where the polygon is equal to the specified polygon
DAll rows where the polygon is contained within the specified polygon
Step-by-Step Solution
Solution:
  1. Step 1: Understand the operator

    The operator @> means "contains" in geometric types.
  2. Step 2: Analyze the query

    The query selects rows where the polygon column contains the given polygon.
  3. Final Answer:

    All rows where the polygon contains the specified polygon -> Option A
  4. Quick Check:

    Operator @> means contains [OK]
Quick Trick: Operator @> means contains for geometric types [OK]
Common Mistakes:
  • Confusing @> with && (overlaps)
  • Assuming equality instead of containment
  • Thinking @> means contained by

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes