Sample Header Ad - 728x90

In Postgres, can I CLUSTER by multiple indexes?

0 votes
1 answer
206 views
I want to order the records in my tasks table according to completed and then according to workOrderID, just like I can to with the ORDER BY clause of a SELECT query, so that this | taskID | workOrderID | completed | | -------- | -------------- | --- | | 1 | 1 | t | | 2 | 1 | f | | 3 | 3 | t | | 4 | 2 | t | | 5 | 9 | t | | 6 | 4 | f | | 7 | 5 | f | | 8 | 4 | t | | 9 | 1 | f | is stored like this | taskID | workOrderID | completed | | -------- | -------------- | --- | | 1 | 1 | t | | 4 | 2 | t | | 3 | 3 | t | | 8 | 4 | t | | 5 | 9 | t | | 2 | 1 | f | | 9 | 1 | f | | 6 | 4 | f | | 7 | 5 | f | When I try, I get a syntax error, and I don't see that functionality mentioned in the docs. I think this could speed up some queries.
Asked by aswine (153 rep)
Feb 9, 2024, 08:11 PM
Last activity: Feb 10, 2024, 11:45 PM