Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Intermediate
Jun 4, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Fetch Only Required Columns From a Database to Improve Performance

The call 'select * from <table_name>' becomes costly when tables have a lot of fields. Because every data field would be required to be sent across the network (or processed) and buffered, reducing the number of data fields fetched directly enhances query and application performance. Therefore, you should fetch only required columns from your database and avoid queries like 'select * from <table_name>'. The queries that check for the existence of a record and use 'select * from <table_name>' should be modified by putting * into single quotes. For example, it is better to fire a query like
     select '*' from <table_name> where <field_name> = <value>
in place of
     select * from <table_name> where <field_name> = <value>
to check for the existence of a record.
KulBhushan Sharma
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date