473,411 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Website Run By Offsets Query

hi
Im just curious, im developing a web site for a client the content of
which is vehicles the database has a number of different methods to search
by, but as soon as you get to a singular vehicle you can browse to the next
/ previous vehicle in the database. To do this i use offsets.

My question is when i have a page that simply has a list of vehicles,
say the last 5 added for example, the url has to contain the offset value
for that vehicle. So far the only way i can determine to work out the
position of the vehicle in the recordset is to run a search through the
entire table, counting each entry, then once it hits the entry im after it
records the count (hence the offset value i need). Ive set up a function to
determine this for me. My only concern is that once i start displaying the
list of vehicles, hence running the function every time i want to display a
vehicle link, will this place an intolerable load on the server?

Is their an easier way to get the records position in the table? that will
reduce load on the server?

Cheers - Ben.
Jul 17 '05 #1
1 1543
Really an off topic answer, but who cares.

Mostly you would not use your method but use "LIMIT " in their SQL to show
part or only one of the records. With for instance LIMIT 29, 1 you would
have the thirtiest row. The next would be just incrementing 29 and you don't
need any function to do that. It would be just one database query to get the
next, which I suppose would be the same as retrieving through a key value.
Most likely the response will take a bit longer that way.

Another way, more complicated, is having a field in your database that
points to the next and former record. That way you would retrieve through a
(indexed) key, which should speed up things. Of course you would need to
change everything around inserting and deleting records, because these
pointers would need to be updated and you would need to decide on what
criteria you decide what is the next record, which would be something like a
fixed sort order.

On my local Mysql server the query SELECT * FROM `whatever` LIMIT 130 , 1,
to somewhere in the middle of a table took 0.0079 seconds, and LIMIT 268 , 1
is to the end of this table and takes 0.0136 seconds. This is on a Athlon
600Mhz with one user; I am sure your situation could be faster.

When I do the query on a indexed key field value then the query to the
middle of the table takes 0.0065 seconds.

Conclusion: it really depends on the size of your table. If your table is
not extremely long, I would think the method with LIMIT is sufficiently fast
and will not load your server.

René
www.comunica2.net
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Murphy | last post by:
I have a php-based yahoo-like web directory.I wanna give webmasters the possiblity to integrate my whole directory in their websites with their own formatting.I wanna this inclusion to be possible...
0
by: Phillip Farber | last post by:
Hello, I'm posting here with a somewhat technical question in the hope of finding someone with experience coding C++ against the SP_API in OpenSP 1.5. I have an app that uses the SP_API to...
4
by: Wim Verhavert | last post by:
Hi all, For gathering certain information in building my database, I'm depending on the things I found on the web, especially one website (let's call it www.mywebsite.com). Is there a way to...
7
by: Randy Yates | last post by:
Hi, I work in an embedded environment in which we often use a mix of C and assembly code. Thus a recurring requirement is to be able to take a C header file with structure definitions as input...
5
by: Brent Burkart | last post by:
I want to protect my website with a user and password. I have SQL Server 2000 where I want to store the users and passwords and the website is complete. I just need to add in some security with...
1
by: afadich | last post by:
Hi, Please be nice :) I don't exactly know how to explain this or if I am using the correct terminology. Some background: I am working on a signup page for my website. This page has a...
9
by: Bill Norton | last post by:
I've been experimenting with floats, positioning and offsets (top, left, etc.) to see what happens when you mix the properties together. All this may be old news to most of you, but it was...
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
6
by: Mandar | last post by:
Hi, I have written some code in C# to programmatically create a website and an application pool. Both seems to be getting created alright with whatever settings I have applied. However, when I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.