While creating data source in Tableau I want to choose 20 fields out of 100 fields from the table? How to select only 20 fields from the table?
Hide fields you don't want to use. That is the most efficient approach. Tableau will then leave those fields out of the select clause in any queries and exclude those fields from any extracts.
Here is one way to hide fields.
Connect to the data source and stay in the data connection pane
Switch to list view to see the fields listed one per row (for convenience) by clicking the icon to the left of the sort fields switch
Select the fields you don't wish to use, multiple selection is useful here
Right click or use the caret menu (little black triangle) to hide those fields
P.S. Tableau will always leave fields out of the select statement that you don't reference (i.e. don't put on a shelf). So if you are using a live connection instead of an extract, hiding fields can help reduce the number of fields you have to look at on the data pane, but isn't necessary to improve performance. For extracts, hiding fields can reduce the size of the extract and the time to refresh it.
You might think could help performance by writing custom SQL to only request a subset of the columns, but you would most likely be hurting performance instead by defeating the query optimization that Tableau performs.