The WHERE clause filters rows that satisfy a Boolean condition, returning only the data you need from ParadeDB.
Filtering early trims result sets, speeds queries, and lowers memory usage. ParadeDB follows PostgreSQL rules, so every standard WHERE expression— comparisons, pattern matching, subqueries— works unchanged.
Use SELECT column_list FROM table WHERE condition;
. Combine multiple conditions with AND
, OR
, NOT
, and parentheses for clarity.
Operators = <> > >= < <=
work on numbers, dates, and text. Use ILIKE
for case-insensitive text, BETWEEN ... AND ...
for ranges, and IN (...)
for lists.
Yes. JOIN tables first, then add your WHERE clause. The planner reorders joins for efficiency, so filters are still pushed down.
Combine ParadeDB's vector operators with traditional predicates: ... WHERE embedding <=> embed('shoes') < 0.3 AND stock > 0
. Metadata filters narrow expensive similarity searches.
SELECT o.id,
c.name,
o.total_amount
FROM Orders AS o
JOIN Customers AS c ON c.id = o.customer_id
WHERE o.order_date >= CURRENT_DATE - INTERVAL '30 days'
AND o.total_amount >= 500;
Index columns used in WHERE. Avoid wrapping indexed columns in functions; use expression indexes if needed. Place selective predicates first when chaining with AND for readability.
LIKE '%shoe%'
skips b-tree indexes. Create a trigram/GiST index or use full-text search instead.
Using HAVING when no aggregates are present slows execution. Put non-aggregate filters in WHERE.
Yes. Use WHERE column IN (SELECT ...)
or WHERE EXISTS (SELECT ...)
for advanced filtering. Ensure subqueries are correlated only when necessary.
The planner reorders predicates automatically, but writing the most selective condition first aids readability and doesn’t hurt execution.
Run EXPLAIN
before your query. Look for Index Scan
lines on the filtered table.