Difference between select * from Table & select individual columns
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Difference between select * from Table &... Expand / Collapse
Author
Message
Posted 8/20/2009 2:17:18 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 8/20/2009 2:09:13 PM
Posts: 22, Visits: 21
Hello all,
I am having trouble understanding difference select * from TABLE X or select a , b, c ( columns) from table X ( same table ) above.
I was wondering if someone actually knows what is the difference at the Teradata DB Architecture level.

Thanks,
Aditi
Post #16608
Posted 8/30/2009 6:18:17 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 10/22/2009 4:02:36 PM
Posts: 16, Visits: 40
Well, it helps Teradata when you enslist colum names in the query. By using '*' you add one more stage and asking Teradata to resolve that * first, and then bring the data.

By using specific colum name, Teradata tend to bring data faster, and ensures you are getting data for colums you really need. It is always recommended to use colum names instead of 'SEL * FROM TABLE_NAME;'.
Post #16706
Posted 10/27/2009 8:37:45 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/27/2009 8:39:59 AM
Posts: 2, Visits: 7
Hi

There won't be any difference in the execution plan for both the queries .i.e. Sel * From Tbl and Sel F1, F2 ( all the fields ) From Tbl. The main difference between the above two query processing will be in the Parsing Stage or when the Parser handles the query ( which would be prior to the generation of the query plan).

In the Case of Sel * From Tbl query, The Parser will perform following operations
1. Query Validation which involve:
a. Check the DD tables for the access
b. Check the DD for the obtaining the Database details, table details ( to obtain the field name)
c. Crosscheck the details mentioned in the query with the obtained details from the DD.
In this case it need to check only the Table name and the DB.
2. Completed the query - which will be given to the Optimizer to determine the query plan.

Similarly for the query Sel F1, F2 From Tbl (Assuming that there is only 2 fields in the Tbl) The Parser have to perform the following operations.
1. Query Validation which involve:
a. Check the DD tables for the access
b. Check the DD for the obtaining the Database details, table details ( to obtain the field name)
c. Crosscheck the details mentioned in the query with the obtained details from the DD.
In this case it need to check only the Table name,DB and Fields which is given in the query.
2. Completed the query - which will be given to the Optimizer to determine the query plan.

Since the difference between the query execution persists before the generation of Query plan, functionally there is no major difference.

I hope i had answered your question.

Thank You
Visakh Chandran




Thanks
Visakh chandran
Post #17170
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 10:03pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.188. 10 queries. Compression Disabled.