Kei wrote:
> Hi all,
>
> I have one performance question about select all and select all with limit
> and offset. I do the test for measuring the time usage of the following
> select statement.
>
> Task 1. select * from tablename order by name Task 2. select * from table
> name order by name limit 8 offset 0
>
> and I have 5000 records in arm-platform .
>
> The result in Task 1 and 2 is they use 2 seconds to preform the select
> statement.
>
> I think the action in Task 1 and 2 are that they extract all records from the
> table but Task 2 then limit 8 records, isn't it? Or what does the action in
> task 2?Thanks!
>

It depends.  If there are no indices to work with, then both Task 1 and
Task 2 extract all records from the database and sort them.  But if you
have an index on name:

   CREATE INDEX idx1 ON tablename(name);

Then Task 2 only extracts the first 8 elements from the table.


-- 
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to