Firebird 是否支持过滤索引?

Does Firebird support filtered indexes?

我正在尝试在 Firebird 中创建过滤索引,但我找不到它。可能吗?

我的意思是使用 table 中的部分行的索引。它存在于 MS SQL 服务器中。

我会 post 这作为评论,但我没有足够的声誉。

检查此答案中的这句话:https://dba.stackexchange.com/a/133241

In SQL Server (and maybe other RDBMS's?), this can be worked around using Filtered Indexes. In SQL Server you would add a WHERE condition onto the end of your index definition to say "apply this index only to records with a Status <> 'Complete' ". Then any query using this predicate will most likely use the index on the small amount of records not set to 'Complete'. However, based on the documentation here: http://www.firebirdsql.org/refdocs/langrefupd25-ddl-index.html, it does not look like Firebird supports filtered indexes.

A workaround is to put 'Complete' records in an ArchiveTickets table. Create a table with the exact same definition (though without any auto generated ID) as your Tickets table and maintain rows between them by pushing 'Complete' records to the ArchiveTickets table. The Index on your Tickets table will then be over a much smaller number of records and be much higher performance. This will likely mean you will need to change any reports etc that reference 'Complete' tickets to point to the Archive table or perform a UNION across both Tickets and ArchiveTickets. This will have the advantage of not only being fast, but will also mean that you can create specific indexes for the ArchiveTickets table to make it perform better for other queries (for instance: Give me the average time to completion for complete tickets) which are not needed on the Tickets table.

不,Firebird 没有过滤(或部分)索引。 Firebird 跟踪器中有一个改进票:http://tracker.firebirdsql.org/browse/CORE-3384,但还没有计划一个版本。