File sort performance


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File sort performance
# 8  
Old 09-22-2015
Apologies, the directory I was using is (i.e. directory1 is /powerdata0013/ALMDW/SrcFiles/ALM/QRM)

Code:
 /dev/powerdata0013 /powerdata0010/FMIS/SrcFiles/AP_578 mmfs   13 Sep 18:53 rw,mtime,atime,dev=powerdata0013

Code:
uname -a
AIX srvpoweprask04 1 6 000A713AD400

# 9  
Old 09-24-2015
I ran a test on an old AIX 5.3 system.
Its /usr/bin/sort is a really bad implementation. It hardly uses more than 4 MB of memory.
The -y attempt did not have a measurable effect - the many GB of free RAM are not used.
Even a sort in Perl would be faster than the /usr/bin/sort.

Can't say anything about the current AIX version.
Maybe there is a GNU sort provided by IBM support or by other sources like AIX Open Source Packages | Main / AIX Open Source Packages ?

Last edited by MadeInGermany; 09-24-2015 at 10:27 AM.. Reason: 5.3 not 3
# 10  
Old 09-24-2015
Thanks MadeInGermany. But, I don't have a clue whether we have one. Can you please let me know how to do it in perl? So that I can give it a try.
# 11  
Old 09-24-2015
If I remember my data structures correctly, a bucket sort might help. If you can break up the file in 20 - 50 buckets based on either the first character, first few characters or word, you can put each set of values into a separate file. For example if the file begins with the lower case letters a-z you can read through the whole file once and if the current line starts with a write it to the a_line.dat file, if it is b write it to the b_line.dat file, etc. Now you have the file broken down into 26, hopefully equal files. Each file should be approximately 300-400 MB. which would better lend itself to an in memory sort. If you need to create a single sorted file, then just concatenate each of the *_line.dat files into a new sorted file in order from a to z. So this would be a divide and conquer approach.

Perl does have a bucket sort module, but if you are doing an in memory sort you are limited to the amount of free memory that you have.

Sort::Bucket - search.cpan.org
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

2. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

3. Shell Programming and Scripting

Slow performance filtering file

Please, I need help tuning my script. It works but it's too slow. The code reads an acivity log file with 50.000 - 100.000 lines and filters error messages from it. The data in the actlog file look similar to this: 02/08/2011 00:25:01,ANR2034E QUERY MOUNT: No match found using this criteria.... (5 Replies)
Discussion started by: Miila
5 Replies

4. UNIX for Dummies Questions & Answers

I/O performance in HPUX file systems

Hi guys, what is the relation between I/O performance and file systems. I have a file systems called /dcs/data01 which is having 4Tb size. According our application we can split the file system like dcs/data01 -> 1Tb dcs/data02 -> 1Tb dcs/data03 -> 1Tb dcs/data04 -> 1Tb do you... (4 Replies)
Discussion started by: Davinzy
4 Replies

5. Shell Programming and Scripting

Performance issue in UNIX while generating .dat file from large text file

Hello Gurus, We are facing some performance issue in UNIX. If someone had faced such kind of issue in past please provide your suggestions on this . Problem Definition: /Few of load processes of our Finance Application are facing issue in UNIX when they uses a shell script having below... (19 Replies)
Discussion started by: KRAMA
19 Replies

6. UNIX for Dummies Questions & Answers

poor performance processing file with awk

Hello, I'm running a script on AIX to process lines in a file. I need to enclose the second column in quotation marks and write each line to a new file. I've come up with the following: #!/bin/ksh filename=$1 exec >> $filename.new cat $filename | while read LINE do echo $LINE | awk... (2 Replies)
Discussion started by: scooter53080
2 Replies

7. Shell Programming and Scripting

performance issue using gzcat, awk and sort

hi all, I was able to do a script to gather a few files and sort them. here it is: #!/usr/bin/ksh ls *mainFile* |cut -c20-21 | sort > temp set -A line_array i=0 file_name='temp' while read file_line do line_array=${file_line} let i=${i}+1 (5 Replies)
Discussion started by: naoseionome
5 Replies

8. Programming

File - reading - Performance improvement

Hi All I am reading a huge file of size 2GB atleast. I am reading each line and cutting certain columns and writing it to another file. Here is the logic. int main() { string u_line; string Char_List; string u_file; int line_pos; string temp_form_u_file; ... (10 Replies)
Discussion started by: dhanamurthy
10 Replies

9. News, Links, Events and Announcements

Announcing collectl - new performance linux performance monitor

About 4 years ago I wrote this tool inspired by Rob Urban's collect tool for DEC's Tru64 Unix. What makes this tool as different as collect was in its day is its ability to run at a low overhead and collect tons of stuff. I've expanded the general concept and even include data not available in... (0 Replies)
Discussion started by: MarkSeger
0 Replies

10. Programming

performance of writing into a file

Hi , I have a question about performance of writing into a file. Will it take more time to open a file, write a line into the file and close the file if the file size grows bigger and bigger?? Say, I have two files of sizes 100KB and 20MB. Will it take more time to open/write a... (1 Reply)
Discussion started by: shriashishpatil
1 Replies
Login or Register to Ask a Question