order by on views

Danny Lewkin daniel.lewkin at cognosis.be
Tue Apr 13 09:11:25 CDT 2010


Hey Ruslan, Ivan,

regarding the slow select on views with order by, I have some remarks : 

1. SELECT * FROM vw_organisation_users_lst takes : 15:58:59 Query time: 2.279 sec

2. SELECT pkid FROM vw_organisation_users_lst takes : 15:58:44 Query time: 0.048 sec

3. SELECT * FROM vw_organisation_users_lst ORDER BY pkid ASC takes : 15:58:29 Query time: 2.184 sec

4. SELECT pkid FROM vw_organisation_users_lst ORDER BY pkid ASC takes : 15:56:01 Query time: 2.182 sec

The time to do a select * and to do a select pkid.. order by pkid is identical.

So, it seems that with an order by, you always build the complete view(with all fields), and without order by only the requested fields.
My question is now, why? 

I think an order by on a view, would be much faster, if the view was first build with only the selected fields (+fields that I want to order by).

Would that be possible to implement?

Regards,

Danny Lewkin
 


More information about the Valentina mailing list