I want to select million records from a table and I am using select
query for this.
Currently it is taking a few minutes to get data. Can I get it quickly?<
Best way Fast Performance Tips for SQL Usiing SELECT Statements
1:- Check Indexes. 2:- There should be indexes on all fields used in the WHERE and JOIN portions of the SQL statement 3:- Limit Size of Your Working Data Set. 4:- Only Select Fields You select as Need. 5:- Remove Unnecessary Table and index 6:- Remove OUTER JOINS. 7:- Remove Calculated Fields in JOIN and WHERE Clauses.
Use Indexing for your table fields for fetching data fast.
Reference:
http://www.tutorialspoint.com/sql/sql-indexes.htm
The speed of the query depends on the number of rows but if you do appropriate optimizations taking the performance factors such as:
the query will execute faster.
There's a few factors that would go into this. A quick list of things to look at:
This is really just the tip of the iceberg, but some of the easiest things to implement will also provide you with some of the biggest performance boosts.