2

I've read a lot of questions about that but i couldn't find one.

What is a relevant and efficient way to display millions of data?

string query = "SELECT * FROM tbl_employee";
MySqlCommand cmd = new MySqlCommand(query, Constring);
MySqlDataReader Reader;

try
{
    Constring.Open();
    Reader = cmd.ExecuteReader();
    while (Reader.Read())
    {
        string name = Reader.GetString("name");
        dataGridView1.Rows.Add(name);
    }
}
catch (Exception)
{
    throw;
}
Constring.Close();
  • 7
    Don't display millions of data together... it is not a good idea... use pagination and display only one page of data and allow user to navigate thru pages of data... Google has millions of search results but it does not show all the result in one page... – Chetan Jun 23 '21 at 07:34
  • 2
    Step 1: Rethink. There are no users who want to or even can process this amount of data. Instead use pagination and/or filters and a drill down option! - Step2: Don't add the data row by row as this will reformat everything each time and be really slow. Instead Bind the rows to a datatable! – TaW Jun 23 '21 at 07:35
  • 4
    Do not user `SELECT *` if you don't need all the columns data from the table. – Chetan Jun 23 '21 at 07:35
  • Does this answer your question? [Custom Pagination in datatable](https://stackoverflow.com/questions/54995888/custom-pagination-in-datatable) and [How can we do pagination in datagridview in winform](https://stackoverflow.com/questions/2825771/how-can-we-do-pagination-in-datagridview-in-winform) and [paging techniques for datagridview using in winforms applications](https://stackoverflow.com/questions/7298450/paging-techniques-for-datagridview-using-in-winforms-applications) –  Jun 23 '21 at 07:48
  • 1
    If you need only a column use "SELECT name from tbl_employee". In this way you extract only the data you need. – tartarismo Jun 23 '21 at 07:50
  • [A Simple Way for Paging in DataGridView in WinForm Applications](https://www.codeproject.com/Articles/211551/A-Simple-way-for-Paging-in-DataGridView-in-WinForm) • [DataGrid Paging WinForms C#](https://www.codeproject.com/Articles/16303/DataGrid-Paging-C-Windows-Forms) • [Add, Edit, and Delete in DataGridView with Paging](https://www.codeproject.com/Articles/17318/Add-Edit-and-Delete-in-DataGridView-with-Paging) –  Jun 23 '21 at 07:53
  • Way too broad... it is up to you to decide how to show large amount of data - like https://en.wikipedia.org/wiki/The_Million_Dollar_Homepage for example. – Alexei Levenkov Jun 23 '21 at 07:58
  • Please note OP is talking about a **desktop app** and Windows has had support for _virtual_ `ListView`s (particularly when using a native control) for some time now. A wonderful example is _[Process Monitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon)_. _["Advanced logging architecture scales to **tens of millions** of captured events and gigabytes of log data"](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon)_....a tool many of you have probably used. If the use case demands it, the technology is there –  Jun 23 '21 at 08:06

0 Answers0