How to do sum of column when there is 1million records
How to get sum of column soon when there is 1million records or than that in the table?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Suthish NairRank #92 · 22.8K reputationPosted Jun 10, 2011, 4:18 AM EDT
Guest UserRank #1,422 · 1.2K reputationPosted Jun 10, 2011, 4:25 AM EDT
Otherwise you can use a partitioned view which logically splits a large table into smaller tables.
Andrew FensterRank #983 · 2K reputationPosted Jun 10, 2011, 7:58 AM EDT
select SUM(sale_price) from sales
The database can do this kind of thing very efficiently.
Vijay YadavRank #1,637 · 943 reputationPosted Jun 11, 2011, 12:18 AM EDT
I mean to ask it will take more time to fetch the record from millions of record?
Mahesh ChandRank #1 · 393.4K reputationPosted Jun 11, 2011, 4:47 AM EDT
Andrew FensterRank #983 · 2K reputationPosted Jun 13, 2011, 5:49 AM EDT
select SUM(sale_price)
from sales
where store_id = 57
If you have millions of records, you might need to put an index on the store_id column to improve performance.