Hacker News new | past | comments | ask | show | jobs | submit login

The query planner is top notch. I rarely have to worry about query plans. MSSQL will take my 'readable' code and make an efficient plan out of it. Whereas in mysql and postgres there are many times when I have to write less readable SQL code because their query planners are not able to optimize as well. Ex: mysql sometimes has issues with nested statements, and postgres has fences on CTEs.



I read this while I'm right in the middle of trying to figure out why a linked server query which is a simple join on the same table, on two indexed columns, is taking 5 seconds.

I'm not saying MSSql isn't really nice. I'm just saying I found the timing of reading your comment amusing.


Does the server have access to the linked server's statistics?

http://www.benjaminnevarez.com/2011/05/optimizer-statistics-...

> To create the best query plans when you are using a table on a linked server, the query processor must have data distribution statistics from the linked server. Users that have limited permissions on any columns of the table might not have sufficient permissions to obtain all the useful statistics, and might receive a less efficient query plan and experience poor performance


Is there a good reason for this? I can't think of one.

I think a lot of such nonsense is going to go away very soon.


I'm honestly not sure how much of that would be related to the query planner vs linked server network code.

Speaking of which, linked servers (cross OS, cross SQL type database queries) are native in MSSQL, but require a third party odbclink in postgres, which does not appear to have been updated since 2010[0].

[0] - http://www.cybertec.at/en/media/downloads/


Linked servers in Postgres can be implemented using foreign data wrappers (part of the SQL/MED implementation in Postgres - MED = management of external data which is actually in the SQL spec): https://wiki.postgresql.org/wiki/Foreign_data_wrappers


Which are super awesome!

but stuff like "Does not compile with PostgreSQL >= 9.2!", "A patched, but completely untested version", and "The current version does not yet support WHERE clause push-down, column push-down, JOIN push-down, or write operations."[0] are riskier (and a harder sell to management) than having the functionality backed in the core engine and admin interfaces.

[0] - https://github.com/GeoffMontee/tds_fdw


You may want to look at the OPENQUERY syntax, which may help to resolve performance problems related to remote joins.

Edit: Useful if both tables in join are on remote (linked) server


I solved it by breaking it into two queries in my sproc. Suboptimal, but also done :)


Up to a point. Unfortunately this fairly rock solid planner means that a lot of people will keep throwing things at it until until explosions. SQL Server's parameter sniffing often makes me sad, and having to turn on trace flags effectively by default is still fairly annoying.

Otherwise I am pretty happy with the product.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: