Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Heap sorting in perl

by pg (Canon)
on Apr 06, 2003 at 03:17 UTC ( #248386=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Heap sorting in perl
in thread Heap sorting in perl

If those are rows in a database, I agree with dws, just let database do it.

If that particular column is not indexed, I suggest index it, as you need it.

"order by" is usually not too expansive, especially when it only involves indexed range scan.

Depends on your database, some database directly support syntax that allows to retrieve first N rows.

Replies are listed 'Best First'.
Re: Re: Re: Re: Heap sorting in perl
by dws (Chancellor) on Apr 06, 2003 at 04:04 UTC
    If that particular column is not indexed, I suggest index it, as you need it.

    If this is a write-mostly, query-infrequently table, indexing could significantly degrade performance. For log/audit files that record large numbers of miscellaneous value, indexing the values is rarely an effective strategy.

      When this is generally correct, I don't really see a reason why a person want to "sort by" some column containing some miscellaneous values. If unfortunately that's the case, then should look into the data, and have some sort of key information extracted.

      Any way, I believe blakem has his stuff well organized, and what he is doing is reasonable.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248386]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2018-10-20 01:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (111 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!