07-07-2011
It just smushes them together indiscriminately because, when two tables have nothing to do with each other, it's got no way to know which rows are relevant and which aren't. The rows aren't strictly guaranteed to be in any particular order; to be consistent it has to consider all possibilities.
Or do the tables have anything in common you'd like to match on?
10 More Discussions You Might Find Interesting
1. Programming
Hello Group,
What I have is a database with about a dozen fields and one being "City".
What I would like to do is to have a custom query on a single field for multiple items (cities) but I don't know how to do this. I know this is probably kids play for most of you but I am lost. What I have... (4 Replies)
Discussion started by: vestport
4 Replies
2. Shell Programming and Scripting
Hi,
Input
7488 7389 chr1.fa chr1.fa
3546 9887 chr5.fa chr9.fa
7387 7898 chrX.fa chr3.fa
7488 7389 chr21.fa chr3.fa
7488 7389 chr1.fa chr1.fa
3546 9887 chr9.fa chr5.fa
7898 7387 chrX.fa chr3.fa
Desired Output
7488 7389 chr1.fa chr1.fa 2
3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
3. Shell Programming and Scripting
Hi,
input file1
abcd 123 198 xyz1:0909090-0909091
ghij 234 999 xyz2:987654:987655
kilo 7890 7990 xyz3:12345-12357
prem 9 112 xyz5:97-1134
input file2
abcd 123 198 xyz1:0909090-0909091 -9.122 0
abed 88 98 xyz1:98989-090808 -1.234 1.345
ghij 234 999 xyz2:987654:987655 -10.87090909 5... (5 Replies)
Discussion started by: jacobs.smith
5 Replies
4. Shell Programming and Scripting
Hello,
I would like to ask for help with csh script.
An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies
5. Shell Programming and Scripting
my queryis :
select distinct m.name, item_count, item from master m join client p on m.name=p.name where item_count = 1 and item > 1;
But how should I update them?
i used update statetment :
Update from client Set item =1 where m.name=p.name and item_count=1 AND item>1
Is this wrong? (1 Reply)
Discussion started by: siya@
1 Replies
6. Shell Programming and Scripting
Hi All,
I need to read values of 10 columns from oracle query and assign the same to 10 unix variables. The query will return only one record(row).
I tried to append all these columns using a delimiter(;) in the select query and assign the same to a single variable(V) in unix. I thought I... (3 Replies)
Discussion started by: hkrishnan91
3 Replies
7. Shell Programming and Scripting
Hello Gurus,
I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file.
1|ABC DEF|100|10
2|PQ
RS
T|200|20
3| UVWXYZ|300|30
4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
8. Shell Programming and Scripting
What I have:
I have a input.sh (script which basically connect to mysql-db and query's multiple tables to write back the output to output1.out file in a directory)
note: I need to pass an integer (unique_id = anything b/w 1- 1000) next to the script everytime I run the script which generates... (3 Replies)
Discussion started by: kkpand
3 Replies
9. UNIX for Beginners Questions & Answers
HI
I have a dsv file that looks like:
<<BOF>>
record_number|id_number|first name|last name|msisdn|network|points|card number|gender
312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M
313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
Discussion started by: tera
4 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table.
Can you please suggest why? or any better idea?
export FILE="/abc/autom/file/geo_JOB.csv"
Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies
LEARN ABOUT REDHAT
cluster
CLUSTER(7) SQL Commands CLUSTER(7)
NAME
CLUSTER - cluster a table according to an index
SYNOPSIS
CLUSTER indexname ON tablename
INPUTS
indexname
The name of an index.
table The name (possibly schema-qualified) of a table.
OUTPUTS
CLUSTER
The clustering was done successfully.
DESCRIPTION
CLUSTER instructs PostgreSQL to cluster the table specified by table based on the index specified by indexname. The index must already have
been defined on tablename.
When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is
subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated tuples according to their index
order. If one wishes, one can periodically re-cluster by issuing the command again.
NOTES
In cases where you are accessing single rows randomly within a table, the actual order of the data in the heap table is unimportant. How-
ever, if you tend to access some data more than others, and there is an index that groups them together, you will benefit from using CLUS-
TER.
Another place where CLUSTER is helpful is in cases where you use an index to pull out several rows from a table. If you are requesting a
range of indexed values from a table, or a single indexed value that has multiple rows that match, CLUSTER will help because once the index
identifies the heap page for the first row that matches, all other rows that match are probably already on the same heap page, saving disk
accesses and speeding up the query.
During the cluster operation, a temporary copy of the table is created that contains the table data in the index order. Temporary copies of
each index on the table are created as well. Therefore, you need free space on disk at least equal to the sum of the table size and the
index sizes.
CLUSTER preserves GRANT, inheritance, index, foreign key, and other ancillary information about the table.
Because the optimizer records statistics about the ordering of tables, it is advisable to run ANALYZE on the newly clustered table. Other-
wise, the optimizer may make poor choices of query plans.
There is another way to cluster data. The CLUSTER command reorders the original table using the ordering of the index you specify. This can
be slow on large tables because the rows are fetched from the heap in index order, and if the heap table is unordered, the entries are on
random pages, so there is one disk page retrieved for every row moved. (PostgreSQL has a cache, but the majority of a big table will not
fit in the cache.) The other way to cluster a table is to use
SELECT columnlist INTO TABLE newtable
FROM table ORDER BY columnlist
which uses the PostgreSQL sorting code in the ORDER BY clause to create the desired order; this is usually much faster than an index scan
for unordered data. You then drop the old table, use ALTER TABLE...RENAME to rename newtable to the old name, and recreate the table's
indexes. However, this approach does not preserve OIDs, constraints, foreign key relationships, granted privileges, and other ancillary
properties of the table --- all such items must be manually recreated.
USAGE
Cluster the employees relation on the basis of its ID attribute:
CLUSTER emp_ind ON emp;
COMPATIBILITY
SQL92
There is no CLUSTER statement in SQL92.
SQL - Language Statements 2002-11-22 CLUSTER(7)