So querying against a view is actually using a query to query the result of a query, which if often much more overhead (often much easier to code, however - if the query is complex, easier to say "select myID from myView" than a multi-table join all the time - inline code - to get "myID").
If you're using MS SQL Server 2000, you're in luck - Views can now be indexed (not possible in v7; I really don't know about other databases).
And to echo Phillip again, a good index can make all the difference.
So test test test optimize test....
>Because a View is guaranteed correct, otherwise SQL Server wouldn't
>allow it to be created, then the SQL is pre-compiled, while sending a
>fresh bit of SQL to the server has to be compiled at that time
>
>Theoretically the View should be faster - but YMMV!
>
>The only way to guarantee what your results will be is to test it
>yourself
>
>Rember that a good index can make a HUGE difference on a query, a lot
>bigger than just changing it to a View, but changing it might make an
>additional increase
>
>-----Original Message-----
>From: admin [mailto:[EMAIL PROTECTED]
>Sent: Thursday, October 09, 2003 3:03 PM
>To: CF-Talk
>Subject: cfquery vs sql view
>
>
>I was wondering if anyone knew which was more efficient (ie faster)
>doing the select logic like :-
>
>where catagory='catagory name'
>
>in a cfquery or doing it in a sql 2000 database view ?
>
>Cheers
>
>Richard
>
> _____
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

