How to fetch millions of records quickly from Sql Server?
Absolutly unclear, what the issue here is and what you expect? Depending on the average size per row there have to be some GB of data from storage to engine to network to client and I guess the client do something with the data; of course this takes some time.
Tried with index concept & views.
Views are predefined queries and have no effect on performance improvement. And if you query all rows & column data, then an index don't have an effect.
Is really Microsoft Azure supports XP_CMDSHELL?
Which MS Azure SQL solution, there aree many? E.g. SQL Azure don't support XP_CMDSHELL.
Or is there anything alternate?
To achieve what in detail?
So from my understanding, you are not that experienced with Azure, and now you are trying to connect your web app (using Codeigniter => PHP) to connect to an Azure SQL database?!
What kind of Azure SQL Database do you have deployed?
How many compute resources are provided for this database?
And is it really Microsoft SQL Server and not MySQL?
for example,
if that Azure SQL Database is deployed as a "Serverless" and only 2vCPU... maybe that is not the best fit for your solution...
https://learn.microsoft.com/en-us/azure/azure-sql/database/serverless-tier-overview?view=azuresql
An Azure SQL Database Serverless will go to sleep after a configured time and has to wake up if you want to retrieve data...
What kind of Azure SQL Database do you have deployed?
Azure SQL Database only
How many compute resources are provided for this database?
250 GB and 20 DTUS
We are using S1
The Basic, S0, S1 and S2 service objectives provide less than one vCore (CPU)
And is it really Microsoft SQL Server and not MySQL?
Yes It is Microsoft SQL Server and created in Microsoft Azure Portal.
It is still unclear what your data looks like and what kind of query you want to execute...
and just to put some numbers out here:
You are running an S1/20DTU sized Azure SQL DB, so your performance into storage (which might be the most significant "problem" if you want to catch a million rows)
IOPS (approximate)* 1-4 IOPS per DTU => max 80 IOPS
IO latency (approximate) 5 ms (read), 10 ms (write)
That might be very low/slow for querying a massive amount of data with the expectation of a quick response and showing the resultset...
The performance of a database (mainly seen on the front end) is based on several factors like table and data structure (including indexes, statistics, views, etc), the configuration of SQL Server and database, query design, compute power, and often on the application.
That is also a reason why we are asking for your needs, your problems and your details on data/table structure.
There is a titbit: a couple of years ago, I tested a query that returned a decent number of rows. Not a million, but say 20000 on Basic Edition. I ran it with MARS (Multiple Active Result Sets) both enabled and disabled.
My hypothesis was that I would see a major difference in execution time, but it was nine seconds in both cases. I then upgraded my database to P1. Now it was nine seconds with MARS and subsecond without MARS.
Granted, an S1 is better than Basic, but still it is pretty drab. I would recommend that you try upgrading your database to a higher service objective. Yes, it may be above your budget, but that is the great thing - you can scale back down after the test.
Keep in mind that, it is not only a matter of the disk. In the cloud you can be actively throttled so that you don't more than you pay for.
We use select query to fetch records from a table which contains millions of records.
Once we got the result, we loaded it into the html grid(Ignite UI for jQuery).
After grid loaded, we do pagination, filter, etc with that in web.
(We need to load records, filter, paginate quickly like in flipkart, amazon sites)
If we use select query with offset & limit means, It takes too long time to return the result each time request.
So that we fetch all records with single request.
Here we use S0, and S1 service only and still it takes too long time to return the 'select query' result.
Is there any way to do "select query with all record fetching in a single request quickly?".
Please suggest it.
Sign in to comment