Hi All,
I am unable to reclaim space on my NETEZZA server.
This is the Scenario: I created a table:
CREATE TABLE ABCD ( column1 smallint NULL ) distribute on random;
--INserted Data to this table
INSERT INTO ABCD select 1234
INSERT INTO ABCD select 1234
INSERT INTO ABCD select 1234
INSERT INTO ABCD select 1234
--Updated the Table
update abcd
SET column1 = 12345
Now while I run the following nzreclaim command to scanRecords for the no of Rows and Size it will reclaim from the table:
nzreclaim -scanRecords -u admin -pw admin -host host_sample -db database1 -t abcd;
I get '0' No of rows.Which I know is not correct and something that is happening nowdays on my server... Some days back it use to reclaim the space while I run the reclaim command after any update happens on the tables;
Kindly assist why I am not able to reclaim space after an update and nzreclaim ???????
Each Netezza table has a minimum size. When you first instantiate the table, it will take up this minimum amount of space, which is significantly larger than the several records you are placing into it. Even when doing a reclaim, you probably won't see any movement in the table size if it has not breached the minimum.
Try the same scenario with several millions of records where the data size hits into the tens of gb's. Then set aside the reclaim as a viable option for tables this small.
The reclaim is an option of last resort, reserved for tables that are too large to rebuild with a simple CTAS (that is, there's not enough space on the machine for a CTAS, not that it has "too many records"). For a table this small, you should be using the CTAS.
This sample of few records in my question I have mentioned is just for example. I am actually facing this nzreclaim not happening issue in my fact table which is of 30 GB size.
I always have the idea in my background to do a CTAS and resolve this issue, but I am curious to understand why is this nzreclaim not happening which use to happen some days back, that means some of the settings or config files that refers for the nzreclaim must be corrupt in my system.
Another additonal information is I work on two NETEZZA servers, in which one of the server the nzreclaim is working just fine for even the example I gave, but in one server it does not reclaim the space..
I am still awaiting for an answer to my question...
Thanks for your quick response....
Given this information, the cause is almost certainly that you have an open transaction on the server. If someone started a transaction several days ago and never committed it or aborted the session, you cannot reclaim any records in any table that would be visible to that transaction. This is because Netezza is trying to conserve the data as it was at the time that old transaction started. Netezza prevents you from reclaiming records which would be visible to a transaction if that transaction were to access the table (even if the transaction has not yet accessed the table). Once you abort this transaction you should be able to reclaim records as normal.
This is not the case I am running the nzreclaim on a table which is not accessed at all by any transaction.
Thanks for the quick response.
I am still waiting for an answer for my question.
A transaction does not have to access the table to prevent you from reclaiming records. A transaction only has to be active on the system. If there is any transacation which started prior to you deleting rows, NPS will not allow you to reclaim any records which were deleted after that transaction started. I thought I was clear about that on my prior post, hopefully this one clears up it up completely.
For example, if I connect to NPS, start a transaction, and never commit/rollback or disconnect, no records which are deleted after my transaction began can be reclaimed until my transaction is completed. I've seen sitations where a transaction has been left open for weeks and it can cause all sorts of problems in this way. To repeat again, it does not matter if my session accesses a table. No records from *any* table can be reclaimed until my transaction completes regardless of if my transaction has accessed the tables.
Thanks for the detailed response, I checked out the nzsession there is no Active\ Idle sessions.
Please let me know how to close the transactions and debug this issue.
It almost sounds like there is a safety-net necessity to jump into single-user mode to accomplish the reclaim, such that no transactions can accidentally sneak-inside the machine before I can launch the reclaim.
Either way, these are all good reasons to keep the reclaim in a back pocket for a rainy day, or when the box runs out of space to support a CTAS. However, if the box is this close to runnng out of space, there is another problem looming - capacity. So in the end, the need to use a reclaim at all could be a symptom of a larger capacity issue.
Have you backed up your data? I believe in 4.5 or 4.6, nzreclaim will no longer reclaim data unless it is backed up or you use the switch -backupset NONE.
I am using Netezza Version: Release 4.0.2 (P-2) [Build 7208]
The nzreclaim use to work on my server with no additinal conditions. it is only nowadays it is not working. This is truly mysterious for me.
Awaiting for an solution ... Thanks much for the quick responses from all of you
.....
On a separate question, you did not say how many records had been updated when you ran the update command. Are you sure it applied updated values?
Hi,
can you do a show locks and verify that there are no locks? or nzession to see who was what locks?
If you can, you can stop and start the database open the database in exclusive lock mode. this will ensure that there are no zombie transactions out there
then run nz_reclaim from the contrib and check the estimates
and then run nzreclaim on the table
I had a similar situation recently. nzreclaim wasn't reclaiming any rows and nzsession showed no active sessions. However when I ran "nzstats -type query" I could see a query that looked like it had been running for weeks. I ended up doing an nzstop/nzstart and that cleared up the session and afterwards nzreclaim did reclaim rows.
I ran the statement: nzstats -type query it did not give any results. There is no queries running in the background for long time. I did the nzstop and nzstart also, still the problem of nzreclaim not reclaiming the space exists. Thanks for the response. I am still waiting for an solution ...
At this point it is time to engage with your assigned product engineer, who can troubleshoot the problem with higher visibility. Something subtle is afoot and none of us have hands-on access to your machine.
Also as a note, this community is all-volunteer. Your product engineer is not. .