answersLogoWhite

0


Best Answer

Indexing can be faster than sorting. It can also be slower. It depends on how many rows your predicate clause is selecting, and on the data dispersion represented by those index keys. If you are selecting a few rows, such as less than 4% of the table, then by all means use an index. If you are selecting a lot of rows, such as more than 25% of the table, then the use of the index will usually degrade performance, so go for the full table scan followed by a sort. (Of course, now you are adding the use of sort space, so that is a consideration.) The break-even point depends on the particular RDBMS and on the structure of the data. If your RDBMS supports EXPLAIN PLAN, then use it, and learn to know what it means. Also, make sure you understand your data, because (sometimes) only you know the best way to query it, and it might make sense to override the optimzer and force a certain execution plan based on your knowledge.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How is indexing faster than sorting when accessing data from a table?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Statistics

What is the advantages of sorting data?

it helps arrange all records in a table. it is able to deal well with a huge list of items. no additional storage is required.


What a tuple in a relational model?

A row of a table in relational model is known as tuple - is the easy answer. A tuple is a collection of elements that relate to one another : T = R(e1, e2, ... , en). One can view a collection of similar relations, R, as a table, where the elements of same category are projected underneath one another, and ordered as is suited for the table view. When implementing a relational database, the tuples can be spread all over in a way that suits those that make the storage system, and enables fast retrieval and manipulation of them. So, unless you specify the sorting - "Collating Sequence" of the table, you can expect a new ordering every time you view the table. The elements in the relations are bound together in the same way as rows in a table - but some relations may have more elements - "columns" and really belong to other tables - but is "projected" into the view you see as a table.


What are the benefits of normalizing a table in a database?

The following are some of the benefits of normalization:removes redundanciesachieves consistency.improves data accessing speedimproves the performance of the serverdecreases time accessing from the database.generally efficient working of the applicationNormalization was introduced just to have CONSISTENT Data by avoiding REDUNDANCIES. While doing so, it introduces some overhead by having few new tables which definitely has an impact over PERFORMANCE and SPEED, because of involving many tables in the JOIN operation which itself proves the complexity. In short, you can prefer normalization for having Consistent and Clean Data with the cost of Performance and Speed.


Advantages of using indexes in database?

Advantages of an index over no indexIf no index exists on a table, a table scan must be performed for each table referenced in a database query. The larger the table, the longer a table scan takes because a table scan requires each table row to be accessed sequentially. Although a table scan might be more efficient for a complex query that requires most of the rows in a table, for a query that returns only some table rows an index scan can access table rows more efficiently.The optimizer chooses an index scan if the index columns are referenced in the SELECT statement and if the optimizer estimates that an index scan will be faster than a table scan. Index files generally are smaller and require less time to read than an entire table, particularly as tables grow larger. In addition, the entire index may not need to be scanned. The predicates that are applied to the index reduce the number of rows to be read from the data pages.7 If an ordering requirement on the output can be 7 matched with an index column, then scanning the index in column order will 7 allow the rows to be retrieved in the correct order without a sort.Each index entry contains a search-key value and a pointer to the row containing that value. If you specify the ALLOW REVERSE SCANS parameter in the CREATE INDEX statement, the values can be searched in both ascending and descending order. It is therefore possible to bracket the search, given the right predicate. An index can also be used to obtain rows in an ordered sequence, eliminating the need for the database manager to sort the rows after they are read from the table.In addition to the search-key value and row pointer, an index can contain include columns, which are non-indexed columns in the indexed row. Such columns might make it possible for the optimizer to get required information only from the index, without accessing the table itself.Note:The existence of an index on the table being queried does not guarantee an ordered result set. Only an ORDER BY clause ensures the order of a result set.


What is a data table?

a data table is a table to place your observations

Related questions

Sorting IN FOXPRO?

Sorting in FoxPro changes the physical record position in the table. Records can also be rearranged in FoxPro by indexing.


What the difference between primary key and scendary key?

A primary key is a unique identifier for a record in a database table and is used to ensure each record is uniquely identifiable. A secondary key is a key used for sorting and indexing purposes, but can have duplicate values within a table.


When sorting in excel it arranges records in a table that?

By the Value of the field


Physically rearranging the records in a table is called?

It can be called sorting.


When sorting in Excel it arranges records in a table?

By the Value of the field


What are the advantages and disadvantages of indexes in oracle?

The advantages of indexes in Oracle are that it is faster at accessing rows and is useful. The disadvantages are that the table used is small and an index must be used in order to access data.


If a large table contains thousands of records and the application is accessing half of the table which method do you use index searching or full table scan?

Generally, if a select is accessing half of a table it will do a table scan. With thousands of records that should not slow it down much. If you were talking millions of records that might be a different story.


What is the difference between sorting and indexing in Visual Foxpro?

what is indexing and shorting? what is indexing and shorting? Difference Between INDEX and SORTHere is a table that I will refer to during my answer: RecNo cName nAge ----- ----- ---- 1 Rick 34 2 Dan 30 3 Chris 33 An index is a logical reorganization of the data in a table. The record numbers do not change; the index just allows the table to be viewed in an order other than record number order. If I create an index on the cName field in the table above, here are the results: RecNo cName nAge ----- ----- ---- 3 Chris 33 2 Dan 30 1 Rick 34 Notice that even though Rick appears as the last record, it is still the first record in the table (Recno=1). A sort is a physical reorganization of the records in a DBF. If I sort the table above by cName, I get the following table: RecNo cName nAge ----- ----- ---- 1 Chris 33 2 Dan 30 3 Rick 34 Notice that the records in the table have been reorganized: record 1 is no longer "Rick."


Does paint thinner or table salt dissolve faster in benzene?

paint dissolves faster in benzene but table salt does not


What has the author Anestis Tsionis written?

Anestis Tsionis has written: 'Manufacture and evaluation of high accuracy, low cost angular indexing table'


What melts ice cubes faster table salt or sand?

Table Salt.


What is the purpose of an indexing service?

index of a book or periodical, a list, nearly always alphabetical, of the topics treated. This list is usually at the back of a book, and the table of contents is in the front. The index seeks to direct the reader to all names and subjects on which the book has information.