A. Is there the possibility to get the result of ps-script:
$ss=New-Object Microsoft.SqlServer.Management.Smo.Server 'MyServer';
$ss.Databases[$db].Tables | Where-Object {$_.IsIndexable -eq $true}
with the comparable performance to the select
SELECT * FROM sys.Tables WHERE OBJECTPROPERTY(object_id, 'IsIndexable')=1
Of course one way is to run select (from ps) and then instantiate the bunch of smo.table by names (or object_id), something like:
$d = $ss.Databases[$db]
$r = $d.ExecuteWithResults('SELECT object_id FROM sys.tables WHERE OBJECTPROPERTY(object_id, ''IsIndexable'')=1');
$t = @()
foreach ($i in $r.Tables[0].Rows) {$t+=$d.Tables.ItemById($i["object_id"])}
but this is doesn't look "how it should be"..
B. How to improve performance of indexes filter?
$i=$d.Tables.Indexes | where {$_.HasFilter -eq $true};
Of course the same result is possible to achieve quick just but sql:
$d = $ss.Databases[$db]
$r = $d.ExecuteWithResults('SELECT object_id, Name FROM sys.indexes WHERE has_filter=1 ORDER BY object_id, Name');
$t = @()
foreach ($i in $r.Tables[0].Rows) {$t+=$d.Tables.ItemById($i["object_id"]).Indexes[$i["Name"]]}
but I think there should be better solution..