Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: MySQL query question...

by hatter (Pilgrim)
on Aug 12, 2005 at 09:37 UTC ( #483221=note: print w/replies, xml ) Need Help??


in reply to Re: MySQL query question...
in thread MySQL query question...

Perhaps because doing it in SQL, you can take advantage of the indexes and groupings the database provides, rather than having to fetch the whole set and then discard data in your script ? For instance, there's 1000 matches for any day within the range, however you want to display them 25 items at a time - do you fetch 1000 items each time, throwing away an unknown amount of records to find the first 25, then do the same on the second page request for the next 25 ? Or would it be more elegant to just ask the database 'records 26-50 matching these criteria, please ?' ?


the hatter

Replies are listed 'Best First'.
Re^3: MySQL query question...
by CountZero (Bishop) on Aug 13, 2005 at 12:01 UTC
    I would say that by using the module Date::Calc::Iterator you are more efficient as you iterate through the set of dates you want and not make a list of all dates and then discard most of them.

    Also you don't have to pollute your database with a table of all dates in the range you want.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://483221]
help
Chatterbox?
[Corion]: choroboa: A good choice! ;)
[Corion]: I still somewhat wonder if it were worthwhile to replace init / systemd by make with a simple? Makefile listing the dependencies ...
[Discipulus]: i have a different opinion: automation is always worth: first i can use Perl (and this is good), then later you can reuse parts to automate others tasks. My $boss everytime say:'how much time you spend doing this?' So generally i present a perl solution
[Corion]: Discipulus: Yes, but the chart gives some limits on whether it's really worth spending time for saving your time. If you gain enjoyment, automating is still great, but it doesn't save time ;)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-07-27 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (408 votes). Check out past polls.