[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

CLUSTER statement fails with 'server closed the connection unexpectedly'

The following command use to work:

wts1=# CLUSTER inv_search4_idx ON Invoice ;

But now I am getting the following error:

server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

OS Info:
  Postrgesql 7.4.7
  Fedora Core 2

The actual script looks like:

# Knock off any users.  They shouldn't be up this late!

echo
/sbin/service postgresql restart

echo
date
echo -e "\n-->Re-Clustering Orderdate Index on Invoice Table"

/usr/bin/psql -h 192.168.2.144 wts1 <<EOF
CLUSTER inv_search4_idx ON Invoice ;
VACUUM FULL ANALYZE Invoice ;
EOF

echo
date
echo -e "\nDone"

Thanks in advance

0
canyonsw
Asked:
canyonsw
  • 2
  • 2
1 Solution
 
gheistCommented:
Your firewall(or NAT router) in the middle closed connection...
0
 
earth man2Commented:
Maybe you have found a bug in PostgreSQL 7.4.7

Try instead

CREATE TABLE newtable AS
    SELECT columnlist 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.

Maybe you could upgrade to the latest version of PostgreSQL and the problem MAY go away.
0
 
canyonswAuthor Commented:
To gheist:

I thought of this.  The sql fails on the local machine.
0
 
canyonswAuthor Commented:
To earthman2:

I am getting ready to upgrade to Fedora Core 4 ... I'm not quite ready to jump to 5.  I have scripts that create my index and reset the OID.  I can use your solution in the interim without much effort.

Thanks
0
 
gheistCommented:
If you can get new machine then try any distribution with 8.x.y, if it works prepare to jump.
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now