I have a Form A, Form B, Form C. . . and FormSearch. FormSearch can be use by A,B,C...
The purpose of FormSearch is to display data in search for the data you want depending on the query that have been pass on it example

FormSearch has a method pagingData(string sql, int paging limit) and showSimpleData(string sql)
pagingData() method process the query and show FormSearch with paging design
showSimpleData() show only simple FormSearch

Now from Form A it has a button btnA
when i press btnA i use pagingData() because the sql table has a 100k data inside so
if i use the showSimpleData() it will make my program slow.

the problem is when i pass a query in pagingData() method with many joints the FormSearch becomes slow because of the sql query being pass but if i pass a query for example Select * From Table even if the Table has 100k data it is still faster. what can i do with joint table in order to make it faster?

I am thingking about processing top 500 data and output it and then process 99500 for later use.
The way i process data is Table to Temptable. i think this is the problem. please help me make it faster.

Joins are intensive work for the datatbase to do and each subsequent join in the same query just makes it worse. If the search is a repeated one you could consider creating a view of that data and extracting that instead.
Otherwise look for hints online for optimising both the database and the query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.