- Thank you received: 0
Distribution Statistics for Linked Servers
- csmith
- Topic Author
- Offline
- User
-
Less
More
5 years 6 months ago #14428
by csmith
Distribution Statistics for Linked Servers was created by csmith
SQL Server uses statistics on database tables in the query optimizer to find the best plan. Those statistics are used to calculate an estimated count of rows from a table, taking into account filter parameters. For example, when joining table A with 5 rows with table B with 1,000,000 rows, it would make sense to use the 5 rows to seek to records among the 1,000,000 rather than loading the entire million record table.
From what I am seeing in pgnprps (PostgreSQL OLE DB driver, Server Edition) is that all remote tables have an estimated rowcount of 1, regardless of how many rows are actually in the table.
OLE DB providers can provide statistics that SQL Server will use to as described in Distribution Statistics Requirements for OLE DB Providers .
PostgreSQL provides statistics as described in 14.2. Statistics Used by the Planner , specifically the pg_class and pg_stats tables.
It would be really great if your PostgreSQL OLEDB driver could pass these statistics along to SQL Server to improve the ability of SQL Server's query optimizer to make intelligent decisions about how to pull data. I think it would improve the performance of many queries involving linked tables.
Estimated rowcounts of one for all tables is causing some bad plans when SQL Server is surprised to get millions of rows when it thought there would only be one. Even a bigger default constant of 1000 would be helpful.
From what I am seeing in pgnprps (PostgreSQL OLE DB driver, Server Edition) is that all remote tables have an estimated rowcount of 1, regardless of how many rows are actually in the table.
OLE DB providers can provide statistics that SQL Server will use to as described in Distribution Statistics Requirements for OLE DB Providers .
PostgreSQL provides statistics as described in 14.2. Statistics Used by the Planner , specifically the pg_class and pg_stats tables.
It would be really great if your PostgreSQL OLEDB driver could pass these statistics along to SQL Server to improve the ability of SQL Server's query optimizer to make intelligent decisions about how to pull data. I think it would improve the performance of many queries involving linked tables.
Estimated rowcounts of one for all tables is causing some bad plans when SQL Server is surprised to get millions of rows when it thought there would only be one. Even a bigger default constant of 1000 would be helpful.
Please Log in or Create an account to join the conversation.
- admin
- Offline
- Admin
-
Less
More
- Thank you received: 7
5 years 6 months ago #14429
by admin
Replied by admin on topic Distribution Statistics for Linked Servers
This is great suggestion! We will try to incorporate the statistics in the upcoming build.
Please Log in or Create an account to join the conversation.
- admin
- Offline
- Admin
-
Less
More
- Thank you received: 7
5 years 6 months ago #14430
by admin
Replied by admin on topic Distribution Statistics for Linked Servers
We have released SE build 1.4.0.3494 with the support for statistics. Would you try the Server Edition and let us know?
Please Log in or Create an account to join the conversation.
Time to create page: 0.152 seconds