Domanda

I'm new to bloom indexes and currently my table has 3 partial indexes for the same column in the WHERE clause and with different column combinations for the same table. I was trying to replace them all with 1 bloom index.

However, when I create a bloom index with WHERE clause using below syntax, I get below error:

CREATE EXTENSION bloom;

CREATE INDEX idx_bloom_bar ON message USING bloom  
(s, p, c, m, e, id) 
WHERE (islatest = true)
WITH (length=56, col1=4, col2=4, col3=4, col4=4, col5=4, col6=4);
SQL Error [42601]: ERROR: syntax error at or near "WITH"
Position: 165

However, without WHERE clause, I'm able to create this index successfully.

Please let me know if we can use them as a replacement of multiple partial indexes or not to reduce number of indexes on my table.

È stato utile?

Soluzione

The WITH clause comes before the WHERE clause in the CREATE INDEX syntax. You are not free to rearrange the order as you have attempted here.

This ordering is a little unintuitive to me, but that is how it works.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top