🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #835

Performance: Best strategy for non-PK and non-alphabetical sort order for rows?

#835
From: Mitch
Date: Wed, 23 May 2007 09:49
27 lines
2142 bytes
This must be a common problem but I haven't seen it discussed anywhere.

I need to enable my users to easily specify (and re-specify) a position 
for each row relative to the others above and below it. I therefore 
can't use the primary key or other columns to sort by. I must use an 
extra integer column where the sequence is defined by the integer.

Of course I could have the users enter a sequence number in each row 
manually, but as new rows get inserted or reorganised, the previous 
numbers will need to be readjusted and this is a very unsatisfactory option.

I am using the Developer Express grid to drag and drop the rows and they 
have given me code which (upon an insert or drag) automatically 
recalculates the sequence in the grid, often for all the rows in the 
dataset.

This is done on a row by row basis, so the process is very very slow and 
gets slower as the number of rows in the dataset increases. Also, in a 
multi-user situation I suspect this will be unworkable.

Does anyone have any suggestions for accomplishing this in a way which 
numbering is automatic for the user, but which maintains the performance 
and efficiency of a database with > 10,000 rows.

Any clues would be a great help.

Thanks
Technical Details
Message-ID: <46540e25$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,7ed325c4992c39f3,start
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 23 May 2007 10:49:22 +0100
From: Mitch <mmm@yyy.com>
User-Agent: Thunderbird 2.0.0.0 (Windows/20070326)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Performance: Best strategy for non-PK and non-alphabetical sort order
 for rows?
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.168.44.170
Message-ID: <46540e25$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1179913765 81.168.44.170 (23 May 2007 02:49:25 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail