Holi

Holi
Holi

I have written about many Indian festivals, but never about Holi. It is the Hindu festival of colours, much like Diwali being the festival of lights.

For Sikhism, colours are strong depictions of mental state. There is no physical relevance to colours. A Sikh is expected to wear ordinary clothes that do not attract attention. Neither is playing with colours encouraged.

A key ingredient used during holi is called Gulal. Its a deep red coloured powder which is used to colour others. The Guru says this about Gulal:

ਚੀਤਿ ਆਵੈ ਤਾਂ ਰੰਗਿ ਗੁਲਾਲ ॥
When my mind is attached to Him, I am dyed in the deep crimson of His Love.

In the daily Sikh prayer, the first reference to the word colour appears in Japuji Sahib.

ਭਰੀਐ ਮਤਿ ਪਾਪਾ ਕੈ ਸੰਗਿ ॥
But when the intellect is stained and polluted by sins committed by us,

ਓਹੁ ਧੋਪੈ ਨਾਵੈ ਕੈ ਰੰਗਿ ॥
it can only be cleansed by the colour (Love) of His Name.

Sri Guru Granth Sahib recognises two colours: Kusumbh and Majith. Kusumbh is light orange in colour, while Majith is dark red, even crimson. Kusumbh is the color of a flower (Butea monosperma) called “flame of the forest” (called FF henceforth in this post). When its immersed in water for a few hours, the flower looses its colour, and the water becomes coloured.

When Guru Nanak was visiting Mecca, he was asked whether Hinduism was the greater religion or Islam. His reply was as under:

ਕਚਾ ਰੰਗੁ ਕਸੁੰਭ ਦਾ ਪਾਣੀ ਧੋਤੈ ਥਿਰ ਨ ਰਹੋਈ।
As the colour of FF flower is impermanent and is washed away in water, likewise the colours of religiosity are also temporary.

To the contrary, majith is permanent. Its effects are not physical, rather its colouring is for the soul:

ਮਨਮੁਖੁ ਰੰਗੁ ਕਸੁੰਭੁ ਹੈ ਕਚੂਆ ਜਿਉ ਕੁਸਮ ਚਾਰਿ ਦਿਨ ਚਾਗਾ ॥
The self-willed manmukh is like the false color of the FF flower, which fades away; its color lasts for only a few days.

ਖਿਨ ਮਹਿ ਬਿਨਸਿ ਜਾਇ ਪਰਤਾਪੈ ਡੰਡੁ ਧਰਮ ਰਾਇ ਕਾ ਲਾਗਾ ॥੨॥
He perishes in an instant; he is tormented, and punished by the Righteous Judge of Dharma. ||2||

ਸਤਸੰਗਤਿ ਪ੍ਰੀਤਿ ਸਾਧ ਅਤਿ ਗੂੜੀ ਜਿਉ ਰੰਗੁ ਮਜੀਠ ਬਹੁ ਲਾਗਾ ॥
The Lord’s Love, found in the Sat Sangat, the True Congregation, is absolutely permanent, and colorfast.

ਕਾਇਆ ਕਾਪਰੁ ਚੀਰ ਬਹੁ ਫਾਰੇ ਹਰਿ ਰੰਗੁ ਨ ਲਹੈ ਸਭਾਗਾ ॥੩॥
The cloth of the body may be torn to shreds, but still, this beautiful color of the Lord’s Love does not fade away. ||3||

ਹਰਿ ਚਾਰ੍ਹਿਓ ਰੰਗੁ ਮਿਲੈ ਗੁਰੁ ਸੋਭਾ ਹਰਿ ਰੰਗਿ ਚਲੂਲੈ ਰਾਂਗਾ ॥
Meeting with the Blessed Guru, one is dyed in the color of the Lord’s Love, imbued with this deep crimson color.

So how does the Guru celebrate Holi. The answer is obvious:

ਹੋਲੀ ਕੀਨੀ ਸੰਤ ਸੇਵ ॥
Holī kīnī sanṯ sev.
I celebrate the festival of Holi by serving the Saints.

ਰੰਗੁ ਲਾਗਾ ਅਤਿ ਲਾਲ ਦੇਵ ॥੨॥
Rang lāgā aṯ lāl ḏev. ||2||
I am imbued with the deep crimson color of the Lord’s Divine Love. ||2|

Finally I want to share another related hymn:

ਲਾਲ ਰੰਗੁ ਤਿਸ ਕਉ ਲਗਾ ਜਿਸ ਕੇ ਵਡਭਾਗਾ ॥
One is dyed in the (red) color of the Lord’s Love, by great good fortune.

ਮੈਲਾ ਕਦੇ ਨ ਹੋਵਈ ਨਹ ਲਾਗੈ ਦਾਗਾ ॥੧॥
This color is never muddied; no stain ever sticks to it. ||1||

ਪ੍ਰਭੁ ਪਾਇਆ ਸੁਖਦਾਈਆ ਮਿਲਿਆ ਸੁਖ ਭਾਇ ॥
He finds God, the Giver of peace, with feelings of joy.

ਸਹਜਿ ਸਮਾਨਾ ਭੀਤਰੇ ਛੋਡਿਆ ਨਹ ਜਾਇ ॥੧॥ ਰਹਾਉ ॥
The Celestial Lord blends into his soul, and he can never leave Him. ||1||Pause||

ਜਰਾ ਮਰਾ ਨਹ ਵਿਆਪਈ ਫਿਰਿ ਦੂਖੁ ਨ ਪਾਇਆ ॥
Old age and death cannot touch him, and he shall not suffer pain again.

ਪੀ ਅੰਮ੍ਰਿਤੁ ਆਘਾਨਿਆ ਗੁਰਿ ਅਮਰੁ ਕਰਾਇਆ ॥੨॥
Drinking in the Ambrosial Nectar, he is satisfied; the Guru makes him immortal. ||2||

Share

Oracle: Snapshot too old?

Berlin Wall
Berlin Wall
Okay, so you have received the Oracle error ORA-01555 Snapshot Too Old and have no clue how to go about resolving it? This post is made for you then. (The first time an application developer has written about this rather than a DBA.)

First, why does this occur? When you run a query, Oracle retains that data in a “snapshot”. The underlying tables in that query might continue to get changed, but you will see the data as it was when you executed the query. You can keep moving back and forth (rows) within the snapshot using the cursor. However, as you might expect: Oracle cannot hold that snapshot for ever. For how long it retains the snapshot is defined via the UNDO_RETENTION parameter.

So one way to solve this problem might be to increase the limit defined by this parameter. However, that is not always the best solution.

This problem normally occurs when a process opens a cursor (by running the query), and processes each row one by one. For example, let’s assume the process runs a query that returns 10000 rows. Processing each row takes, on average, 10 seconds. It goes on to the next row after processing the previous. Hence the total processing of all these rows will take around 28 hours. If your UNDO_RETENTION is defined as 10 hours, this process will fail on the snapshot too old error.

One of the best ways to solve this problem is to execute performance tuning on this process. This should be carried out specifically on the part of the processes that runs within the query in question, and should be targeted at reducing the time it takes to process one row. For example, if we can get our processing time down to 3 seconds, we will be done within about 8.5 hours, which is below our current setting for UNDO_RETENTION. In most cases, this can actually be done. (Read more here and here.)

A second way to solve the problem is to use a temporary table. For example, suppose you want to analyse all open purchase orders. From the table containing POs, pull the ones that are open, and put them into the temporary table. Since the temporary table is being used only by your process, Oracle will not have to hold the “snapshot” for you. Again the main driver query is the candidate for putting into temporary table. This will also make your process faster overall if it’s based on a not-so-small subset of a large table.

However, a third solution is also possible. For our problem we had a process that had to run for days and days, rather than doing something and finishing. So obviously, we got this error.

To solve the problem, we exited the loop after every n rows, and then reentered it. For example, if the pseudocode looked as below prior to the fix:


select something from somewhere;
while (rows) {
  do process
} 

We changed it as below:


hasAtleastOneRow = True;
while (hasAtleastOneRow) {
  hasAtleastOneRow = False;
  select something from somewhere where rownum<n;
  while (rows) {
    do process
    hasAtleastOneRow = True;
  }
} 

Note that the SELECT statement must have a mechanism to prevent picking up rows that have already been processed earlier. This could be a flag-condition or ‘check’ another table. For example:

select po_id from po_table where po_status='O' and rownum<100
and not exists(select 1 from po_temp where po_table.po_id = po_temp.po_id)

As part of the 'do process' then, we should insert into po_temp.

How do we select the value of 'n'? You will have to do some timing and hit-and-try here. Try to keep the highest value that is guaranteed to take lower processing time compared to the undo retention window.

Share

Licensing and information about the blog available here.