|Title:||xFilter not using correct index?|
|Last Modified:||2015-02-27 20:23:39|
|Version Found In:||18.104.22.168|
anonymous added on 2015-02-27 15:20:23:
Hi! I'm implementing a virtual table in .NET for accessing a custom data source. It's going rather well, but I have an issue regarding BestIndex and Filter. My index (basically a .NET dictionary) isn't being used for queries in the following form: select ... from ... where columnX='...' OR columnX='...' It seems that if the same column is used twice and there is an 'OR' in between, the following happens: - my BestIndex is called twice, but the constraint in the first call is unusable so I can't add it to ConstraintUsages. The second call works fine. - the Filter method is called once but it seems I get the index from the first call to BestIndex (the one with the unusable parameter) so a sequential scan results Is this a bug or am I missing something? Thanks! Antonio
mistachkin added on 2015-02-27 20:23:39:
The xBestIndex can be called more than once. If it is called more than once, the planner chooses the scan with the lowest cost. And that's the one xFilter is called with.