Subject Re: [firebird-support] Re: ORDER BY on large VARCHAR columns
Author Arno Brinkman
Hi,

> > How many records are you retrieving? Do you measure the time it
> > takes to retrieve all the records or only the time it takes to
> > retrieve the first? Do you normally retrieve all the records
> > you select or only the first few?
>
> It could be 2 or 3 hundred thousands. The table itself may have
> millions. Let's say a query could return 200,000 and we do a
> FIRST...SKIP query getting only 15 at a time. The page size is user
> configurable, but it defaults to 15 in each page. Btw, this is with
> 1.0 on Solaris and 1.03 on Windows.

How often are new records inserted?
Are they added by batch (100 new records in 1 transaction)?
Is the insert-speed importand?

You could create a small table where you store PK (from the table in
question) and a SORT_KEY and fill that table with "SELECT PK, INC_NR FROM
YourTable ORDER BY LargeField".
Now you can do a JOIN which used the SORT_KEY and should be really fast.

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://80.126.130.81