Strange Select problem

  • I've got a weird select problem in SQL Server 2000

    When I use this query,

    "SELECT * FROM MyView", I get a resultset in about 18 seconds (myView is a conglomeration of serveral other views many layers deep, and not my doing!).

    When I use this query,

    "SELECT dummyColumn FROM MyView", I get a resultset in about 20 minutes! This flies in the face of everything I've learned about writing good sql. Has anyone encountered this before?

    Thanks,

    Marlon

  • It may have a good reason but the best way to find out is to compare the execution plans and see what is different between them.

  • I ended up rewriting the view. Where I work, they love to pile view upon view upon view. That seems to be the biggest problem with sql server. Anyway, got it down to 2 secs regardless of how you call it now.

    Thanks for your advice

  • I understand your issue and have seen many times. You should avoid using views to create views with a deep level as you will take performance hits in many cases.

  • I second the "no views in views" position. It's easy enough to break things with the broken things breaking other things too!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply