Unix Technical Forum

Getting data in chunks.

This is a discussion on Getting data in chunks. within the MySQL forums, part of the Database Server Software category; --> Hi i am trying to retrive data in chunks like 5 at a time or 10 at a time. ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 04:52 AM
undbund
 
Posts: n/a
Default Getting data in chunks.

Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
time. Can anyone guide me to tutorials on how to go about doing this.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 04:52 AM
Michael Austin
 
Posts: n/a
Default Re: Getting data in chunks.

undbund wrote:
> Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
> time. Can anyone guide me to tutorials on how to go about doing this.
>
> Thanks


5 pink pickles? 5 records? 5 columns? 5 words? 5 bytes?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 04:52 AM
ThanksButNo
 
Posts: n/a
Default Re: Getting data in chunks.

On Apr 9, 9:05 pm, Michael Austin <maus...@firstdbasource.com> wrote:
> undbund wrote:
> > Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
> > time. Can anyone guide me to tutorials on how to go about doing this.

>
> > Thanks

>
> 5 pink pickles? 5 records? 5 columns? 5 words? 5 bytes?


If it makes any difference, I vote for the pink pickles.

Never seen one, let alone five, so it should be interesting.

;-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 08:03 AM
John Andersen
 
Posts: n/a
Default Re: Getting data in chunks.

On Apr 10, 4:24 am, undbund <undb...@gmail.com> wrote:
> Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
> time. Can anyone guide me to tutorials on how to go about doing this.
>
> Thanks


Lookup the LIMIT feature in the MySQL manual.
John
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-10-2008, 05:14 PM
undbund
 
Posts: n/a
Default Re: Getting data in chunks.

On Apr 10, 4:54 pm, John Andersen <j.andersen...@gmail.com> wrote:
> On Apr 10, 4:24 am, undbund <undb...@gmail.com> wrote:
>
> > Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
> > time. Can anyone guide me to tutorials on how to go about doing this.

>
> > Thanks

>
> Lookup the LIMIT feature in the MySQL manual.
> John



I have found out how to do this using LIMIT.

Thanks for all your help.

Bye
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-10-2008, 05:14 PM
Gilbert
 
Posts: n/a
Default Re: Getting data in chunks.

John Andersen wrote:

> On Apr 10, 4:24 am, undbund <undb...@gmail.com> wrote:
>> Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
>> time. Can anyone guide me to tutorials on how to go about doing this.
>>
>> Thanks

>
> Lookup the LIMIT feature in the MySQL manual.
> John


Does anyone know how LIMIT actually works in practice. I would assume that
the first read would return the first X records starting at record 1. When
the second read happens does the server physically start at X+1 and return
X records or does it actually re-read the first X records to get to the
starting point? And the third read? I guess what I'm getting at is MySQL
smart enough to remember where the last access finished (and if so, how) or
do we end up reading from the start of the table each time?

Does using LIMIT provide an indemnepotant view of the underlying table or
are we vulnerable to changes made in the underlying table between accesses?

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-10-2008, 05:14 PM
Captain Paralytic
 
Posts: n/a
Default Re: Getting data in chunks.

On 10 Apr, 12:50, Gilbert <bugger....@no.spam.com> wrote:
> John Andersen wrote:
> > On Apr 10, 4:24 am, undbund <undb...@gmail.com> wrote:
> >> Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
> >> time. Can anyone guide me to tutorials on how to go about doing this.

>
> >> Thanks

>
> > Lookup the LIMIT feature in the MySQL manual.
> > John

>
> Does anyone know how LIMIT actually works in practice. I would assume that
> the first read would return the first X records starting at record 1. When
> the second read happens does the server physically start at X+1 and return
> X records or does it actually re-read the first X records to get to the
> starting point? And the third read? I guess what I'm getting at is MySQL
> smart enough to remember where the last access finished (and if so, how) or
> do we end up reading from the start of the table each time?
>
> Does using LIMIT provide an indemnepotant view of the underlying table or
> are we vulnerable to changes made in the underlying table between accesses?
>
> Regards


More to the point, suppose you are doing a "LIMIT 0,10".

When you then do a "LIMIT 10,10", what happens if one of the original
first 10 records has now been deleted. Will you then jump over one of
the records that you didn't see in the first hit?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-10-2008, 05:14 PM
Peter H. Coffin
 
Posts: n/a
Default Re: Getting data in chunks.

On Wed, 9 Apr 2008 21:18:05 -0700 (PDT), ThanksButNo wrote:
> On Apr 9, 9:05 pm, Michael Austin <maus...@firstdbasource.com> wrote:
>> undbund wrote:
>> > Hi i am trying to retrive data in chunks like 5 at a time or 10 at a
>> > time. Can anyone guide me to tutorials on how to go about doing this.

>>
>> > Thanks

>>
>> 5 pink pickles? 5 records? 5 columns? 5 words? 5 bytes?

>
> If it makes any difference, I vote for the pink pickles.
>
> Never seen one, let alone five, so it should be interesting.


They're usually made from ginger root. Quite tasty.

--
9. If a self-destruct mechanism is necessary, it will not be a large red button
labelled "Danger: Do Not Push". The big red button marked "Do Not Push" will
instead trigger a spray of bullets on anyone stupid enough to disregard it.
--Peter Anspach's list of things to do as an Evil Overlord
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-11-2008, 12:53 AM
Gordon Burditt
 
Posts: n/a
Default Re: Getting data in chunks.

>> > Lookup the LIMIT feature in the MySQL manual.
>> > John

>>
>> Does anyone know how LIMIT actually works in practice. I would assume that
>> the first read would return the first X records starting at record 1. When
>> the second read happens does the server physically start at X+1 and return
>> X records or does it actually re-read the first X records to get to the
>> starting point? And the third read? I guess what I'm getting at is MySQL


It does need to read the records to the extent of figuring out whether
they are to be selected, or to sort them to determine order.
If the query cache can't be used, it needs to do this on each query.

>> smart enough to remember where the last access finished (and if so, how) or
>> do we end up reading from the start of the table each time?


MySQL is smart enough to NOT make the result of one query depend on
invisible variables set by previous queries. LIMIT is not a cursor.

>> Does using LIMIT provide an indemnepotant view of the underlying table or
>> are we vulnerable to changes made in the underlying table between accesses?


Can you get this by starting a transaction (using InnoDB tables)?

>> Regards

>
>More to the point, suppose you are doing a "LIMIT 0,10".
>
>When you then do a "LIMIT 10,10", what happens if one of the original
>first 10 records has now been deleted. Will you then jump over one of
>the records that you didn't see in the first hit?


LIMIT does not provide you with a cursor. It does not carry over context
from previous queries, except to the extent they modify the database.
If the database changes between your queries, so be it.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-11-2008, 12:53 AM
Gilbert
 
Posts: n/a
Default Re: Getting data in chunks.

Gordon Burditt wrote:

>>> > Lookup the LIMIT feature in the MySQL manual.
>>> > John
>>>
>>> Does anyone know how LIMIT actually works in practice. I would assume
>>> that the first read would return the first X records starting at record
>>> 1. When the second read happens does the server physically start at X+1
>>> and return X records or does it actually re-read the first X records to
>>> get to the starting point? And the third read? I guess what I'm getting
>>> at is MySQL

>
> It does need to read the records to the extent of figuring out whether
> they are to be selected, or to sort them to determine order.
> If the query cache can't be used, it needs to do this on each query.
>
>>> smart enough to remember where the last access finished (and if so, how)
>>> or do we end up reading from the start of the table each time?

>
> MySQL is smart enough to NOT make the result of one query depend on
> invisible variables set by previous queries. LIMIT is not a cursor.
>


Thats what I suspected, which, in conjunction with the fact that the
database could change between requests, makes me wonder what you'd actually
use LIMIT for?

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com