Sreedhar goud
Sreedhar goud

Reputation: 81

How to write sql select query to get data faster?

I have a table with 20,000 records when i write query as follows to retrieve data

select emp_id from emp;

it is talking 13 to 15 sec to execute how can i get data faster from the table. Note it is not 20,000 also more.

here is the out put emp_id nothing but mtrl_cd here

 columnname ID      PK null       datatype     Histogram  numdistinct
    MTRL_DESC   2       Y   VARCHAR2 (100 Byte)   None    19480         
    MTRL_CD     1   1   N   VARCHAR2 (9 Byte)     None    19990

Upvotes: 0

Views: 507

Answers (2)

Jomy John
Jomy John

Reputation: 6528

The main fact when you access a large data is always get those data which actually required by you. For that we use conditions in quires. Common conditions we use are, paging, search conditions, show only those records which are related to some data etc. So consider this as a design issue.

[Edit]

If you want those large data to be linked to a combo box , jut see the following article.

jQuery Searchable DropDown Plugin Demo

ASP.NET AJAX Control Toolkit

How do I use the ComboBox Control? (C#)

Upvotes: 1

urlreader
urlreader

Reputation: 6615

if emp_id is primary key already, you won't be able to do much for this simple SELECT. the reason why the screen is slow is because you bind > 20000 items to the combo box.

one possible solution is: ajax autocomplete, here is a sample for .net. http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx

Upvotes: 2

Related Questions