diff --git a/pgadmin/dlg/dlgView.cpp b/pgadmin/dlg/dlgView.cpp
index fab920d..1013750 100644
--- a/pgadmin/dlg/dlgView.cpp
+++ b/pgadmin/dlg/dlgView.cpp
@@ -29,11 +29,49 @@
 #define txtSqlBox           CTRL_SQLBOX("txtSqlBox")
 #define chkSecurityBarrier  CTRL_CHECKBOX("chkSecurityBarrier")
 
+/* Materialized view Settings */
+#define stMaterializedView        CTRL_STATIC("stMaterializedView")
+#define chkMaterializedView       CTRL_CHECKBOX("chkMaterializedView")
+#define stTableSpace              CTRL_STATIC("stTableSpace")
+#define cboTablespace             CTRL_COMBOBOX("cboTablespace")
+#define stFillFactor              CTRL_STATIC("stFillFactor")
+#define txtFillFactor             CTRL_TEXT("txtFillFactor")
+#define chkVacEnabled             CTRL_CHECKBOX("chkVacEnabled")
+#define chkToastVacEnabled        CTRL_CHECKBOX("chkToastVacEnabled")
+#define lstStorageParam           CTRL_LISTVIEW("lstStorageParam")
+#define stStorageParam            CTRL_STATIC("stStorageParam")
+#define cboStorageParam           CTRL_COMBOBOX("cboStorageParam")
+#define stStorageValue            CTRL_STATIC("stStorageValue")
+#define txtStorageValue           CTRL_TEXT("txtStorageValue")
+#define radioBtnTable             CTRL_RADIOBUTTON("radioBtnTable")
+#define radioBtnToastTable        CTRL_RADIOBUTTON("radioBtnToastTable")
+#define btnAdd                    CTRL_BUTTON("btnAdd")
+#define btnRemove                 CTRL_BUTTON("btnRemove")
 
 
 BEGIN_EVENT_TABLE(dlgView, dlgSecurityProperty)
 	EVT_STC_MODIFIED(XRCID("txtSqlBox"),            dlgProperty::OnChangeStc)
 	EVT_CHECKBOX(XRCID("chkSecurityBarrier"),       dlgProperty::OnChange)
+
+	/* Materialized view setting */
+	EVT_CHECKBOX(XRCID("chkMaterializedView"),         dlgView::OnCheckMaterializedView)
+	EVT_TEXT(XRCID("txtFillFactor"),                   dlgView::OnChangeVacuum)
+	EVT_TEXT(XRCID("txtStorageValue"),                 dlgView::OnChangeVacuum)
+
+	EVT_CHECKBOX(XRCID("chkVacEnabled"),               dlgView::OnCheckTableVacuum)
+	EVT_CHECKBOX(XRCID("chkToastVacEnabled"),          dlgView::OnCheckTableVacuum)
+
+	EVT_LIST_ITEM_SELECTED(XRCID("lstStorageParam"),   dlgView::OnStorageParamListSelChange)
+
+	EVT_COMBOBOX(XRCID("cboTablespace"),               dlgView::OnChangeVacuum)
+	EVT_COMBOBOX(XRCID("cboStorageParam"),             dlgView::OnChangeVacuum)
+
+	EVT_RADIOBUTTON(XRCID("radioBtnTable"),            dlgView::OnRadioButtonSelChange)
+	EVT_RADIOBUTTON(XRCID("radioBtnToastTable"),       dlgView::OnRadioButtonSelChange)
+
+	EVT_BUTTON(XRCID("btnAdd"),                        dlgView::OnAddButtonClicked)
+	EVT_BUTTON(XRCID("btnRemove"),                     dlgView::OnRemoveButtonClicked)
+
 END_EVENT_TABLE();
 
 
@@ -49,6 +87,21 @@ dlgView::dlgView(pgaFactory *f, frmMain *frame, pgView *node, pgSchema *sch)
 	view = node;
 
 	seclabelPage = new ctlSeclabelPanel(nbNotebook);
+
+	lstStorageParam->CreateColumns(0, _("Parameter"), _("Toast Table ?"), _("Value"));
+
+	wxTextValidator mviewNumericValidator(wxFILTER_NUMERIC);
+	txtFillFactor->SetValidator(mviewNumericValidator);
+	txtStorageValue->SetValidator(mviewNumericValidator);
+
+	//Initlially disbale the materialize view
+	DisableMaterializedView();
+
+	//select table in radio button
+	radioBtnTable->SetValue(true);
+
+	//fill the combo box list for storage parameter
+	AddRemoveStorageParameter();
 }
 
 
@@ -71,6 +124,11 @@ int dlgView::Go(bool modal)
 
 	chkSecurityBarrier->Enable(connection->BackendMinimumVersion(9, 2));
 
+	if (connection->BackendMinimumVersion(9, 3))
+	{
+		PrepareTablespace(cboTablespace);
+	}
+
 	if (view)
 	{
 		// edit mode
@@ -78,10 +136,366 @@ int dlgView::Go(bool modal)
 		oldDefinition = view->GetFormattedDefinition();
 		txtSqlBox->SetText(oldDefinition);
 		chkSecurityBarrier->SetValue(view->GetSecurityBarrier() == wxT("true"));
+
+		if ((connection->BackendMinimumVersion(9, 3) && view))
+		{
+			//While editing the view, if it is materialized view then only change
+			if (view->IsMaterializedView(view->GetSchema()->GetName(),view->GetName()))
+			{
+				//enable the all the controls depending on the value
+				settingAutoVacuum = false;
+				chkMaterializedView->SetValue(true);
+				chkMaterializedView->Disable();
+				txtFillFactor->Enable();
+				chkVacEnabled->Enable();
+				chkToastVacEnabled->Enable();
+				cboTablespace->Enable();
+
+				//If materialized view then not allow to change the normal view property like security barrier
+				chkSecurityBarrier->Disable();
+
+				txtFillFactor->SetValue(view->GetFillFactor());
+				txtFillFactor->SetValidator(mviewNumericValidator);
+
+				if (view->GetTablespaceOid() != 0)
+					cboTablespace->SetKey(view->GetTablespaceOid());
+
+				pgSetIterator avSet(connection,
+									wxT("SELECT name, setting FROM pg_settings WHERE name like '%vacuum%' ORDER BY name"));
+
+				while (avSet.RowsLeft())
+				{
+					wxString name = avSet.GetVal(wxT("name"));
+					wxString setting = avSet.GetVal(wxT("setting"));
+
+					if (name == wxT("autovacuum_vacuum_cost_delay"))
+						settingCostDelay = setting;
+					else if (name == wxT("vacuum_cost_delay"))
+					{
+						if (StrToLong(settingCostDelay) < 0)
+							settingCostDelay = setting;
+					}
+					else if (name == wxT("autovacuum_vacuum_cost_limit"))
+						settingCostLimit = setting;
+					else if (name == wxT("vacuum_cost_limit"))
+					{
+						if (StrToLong(settingCostLimit) < 0)
+							settingCostLimit = setting;
+					}
+					else if (name == wxT("autovacuum_vacuum_scale_factor"))
+						settingVacFactor = setting;
+					else if (name == wxT("autovacuum_analyze_scale_factor"))
+						settingAnlFactor = setting;
+					else if (name == wxT("autovacuum_vacuum_threshold"))
+						settingVacBaseThr = setting;
+					else if (name == wxT("autovacuum_analyze_threshold"))
+						settingAnlBaseThr = setting;
+					else if (name == wxT("vacuum_freeze_min_age"))
+						settingFreezeMinAge = setting;
+					else if (name == wxT("autovacuum_freeze_max_age"))
+						settingFreezeMaxAge = setting;
+					else if (name == wxT("vacuum_freeze_table_age"))
+						settingFreezeTableAge = setting;
+					else
+						settingAutoVacuum = avSet.GetBool(wxT("setting"));
+				}
+
+				tableVacBaseThr = wxT("-1");
+				tableAnlBaseThr = wxT("-1");
+				tableCostDelay = wxT("-1");
+				tableCostLimit = wxT("-1");
+				tableFreezeMinAge = wxT("-1");
+				tableFreezeMaxAge = wxT("-1");
+				tableVacFactor = wxT("-1");
+				tableAnlFactor = wxT("-1");
+				tableFreezeTableAge = wxT("-1");
+
+				toastTableVacBaseThr = wxT("-1");
+				toastTableCostDelay = wxT("-1");
+				toastTableCostLimit = wxT("-1");
+				toastTableFreezeMinAge = wxT("-1");
+				toastTableFreezeMaxAge = wxT("-1");
+				toastTableVacFactor = wxT("-1");
+				toastTableFreezeTableAge = wxT("-1");
+
+				toastTableHasVacuum = false;
+				toastTableVacEnabled = false;
+
+				if (!connection->BackendMinimumVersion(9, 3))
+				{
+					pgSetIterator set(connection, wxT("SELECT * FROM pg_autovacuum WHERE vacrelid=") + view->GetOidStr());
+					if (set.RowsLeft())
+					{
+						hasVacuum = true;
+
+						tableVacEnabled = set.GetBool(wxT("enabled"));
+						chkVacEnabled->SetValue(tableVacEnabled);
+
+						tableVacBaseThr = set.GetVal(wxT("vac_base_thresh"));
+						tableAnlBaseThr = set.GetVal(wxT("anl_base_thresh"));
+						tableCostDelay = set.GetVal(wxT("vac_cost_delay"));
+						tableCostLimit = set.GetVal(wxT("vac_cost_limit"));
+						tableVacFactor = set.GetVal(wxT("vac_scale_factor"));
+						tableAnlFactor = set.GetVal(wxT("anl_scale_factor"));
+
+						if (connection->BackendMinimumVersion(8, 2))
+						{
+							tableFreezeMinAge = set.GetVal(wxT("freeze_min_age"));
+							tableFreezeMaxAge = set.GetVal(wxT("freeze_max_age"));
+						}
+					}
+					else
+					{
+						hasVacuum = false;
+						chkVacEnabled->SetValue(true);
+					}
+
+					if (tableVacEnabled)
+					{
+						lstStorageParam->Enable();
+						cboStorageParam->Enable();
+						txtStorageValue->Enable();
+						btnAdd->Enable();
+						btnRemove->Enable();
+						radioBtnTable->Enable();
+					}
+				}
+				else if (view)
+				{
+					if (view->GetAutoVacuumEnabled() == 2)
+						tableVacEnabled = settingAutoVacuum;
+					else
+						tableVacEnabled = view->GetAutoVacuumEnabled() == 1;
+					if (!view->GetAutoVacuumVacuumThreshold().IsEmpty())
+						tableVacBaseThr = view->GetAutoVacuumVacuumThreshold();
+					if (!view->GetAutoVacuumAnalyzeThreshold().IsEmpty())
+						tableAnlBaseThr = view->GetAutoVacuumAnalyzeThreshold();
+					if (!view->GetAutoVacuumVacuumScaleFactor().IsEmpty())
+						tableVacFactor = view->GetAutoVacuumVacuumScaleFactor();
+					if (!view->GetAutoVacuumAnalyzeScaleFactor().IsEmpty())
+						tableAnlFactor = view->GetAutoVacuumAnalyzeScaleFactor();
+					if (!view->GetAutoVacuumVacuumCostDelay().IsEmpty())
+						tableCostDelay = view->GetAutoVacuumVacuumCostDelay();
+					if (!view->GetAutoVacuumVacuumCostLimit().IsEmpty())
+						tableCostLimit = view->GetAutoVacuumVacuumCostLimit();
+					if (!view->GetAutoVacuumFreezeMinAge().IsEmpty())
+						tableFreezeMinAge = view->GetAutoVacuumFreezeMinAge();
+					if (!view->GetAutoVacuumFreezeMaxAge().IsEmpty())
+						tableFreezeMaxAge = view->GetAutoVacuumFreezeMaxAge();
+					if (!view->GetAutoVacuumFreezeTableAge().IsEmpty())
+						tableFreezeTableAge = view->GetAutoVacuumFreezeTableAge();
+
+					chkVacEnabled->SetValue(tableVacEnabled);
+					if (tableVacEnabled)
+					{
+						lstStorageParam->Enable();
+						cboStorageParam->Enable();
+						txtStorageValue->Enable();
+						btnAdd->Enable();
+						btnRemove->Enable();
+						radioBtnTable->Enable();
+					}
+
+					toastTableVacEnabled = false;
+
+					if (view->GetToastAutoVacuumEnabled() == 2)
+						toastTableVacEnabled = settingAutoVacuum;
+					else
+						toastTableVacEnabled  = view->GetToastAutoVacuumEnabled() == 1;
+					if (!view->GetToastAutoVacuumVacuumThreshold().IsEmpty())
+						toastTableVacBaseThr = view->GetToastAutoVacuumVacuumThreshold();
+					if (!view->GetToastAutoVacuumVacuumScaleFactor().IsEmpty())
+						toastTableVacFactor = view->GetToastAutoVacuumVacuumScaleFactor();
+					if (!view->GetToastAutoVacuumVacuumCostDelay().IsEmpty())
+						toastTableCostDelay = view->GetToastAutoVacuumVacuumCostDelay();
+					if (!view->GetToastAutoVacuumVacuumCostLimit().IsEmpty())
+						toastTableCostLimit = view->GetToastAutoVacuumVacuumCostLimit();
+					if (!view->GetToastAutoVacuumFreezeMinAge().IsEmpty())
+						toastTableFreezeMinAge = view->GetToastAutoVacuumFreezeMinAge();
+					if (!view->GetToastAutoVacuumFreezeMaxAge().IsEmpty())
+						toastTableFreezeMaxAge = view->GetToastAutoVacuumFreezeMaxAge();
+					if (!view->GetToastAutoVacuumFreezeTableAge().IsEmpty())
+						toastTableFreezeTableAge = view->GetToastAutoVacuumFreezeTableAge();
+
+					chkToastVacEnabled->SetValue(toastTableVacEnabled);
+
+					if (toastTableVacEnabled)
+					{
+						lstStorageParam->Enable();
+						cboStorageParam->Enable();
+						txtStorageValue->Enable();
+						btnAdd->Enable();
+						btnRemove->Enable();
+						radioBtnToastTable->Enable();
+					}
+				}
+
+				if (connection->BackendMinimumVersion(9, 3))
+				{
+					long pos = 0;
+					wxString toastTableValue = wxT("false");
+
+					if (!(tableVacBaseThr.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM base threshold");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableVacBaseThr);
+						pos++;
+					}
+
+					if (!(tableAnlBaseThr.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("ANALYZE base threshold");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableAnlBaseThr);
+						pos++;
+					}
+
+					if (!(tableVacFactor.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM scale factor");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableVacFactor);
+						pos++;
+					}
+
+					if (!(tableAnlFactor.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("ANALYZE scale factor");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableAnlFactor);
+						pos++;
+					}
+
+					if (!(tableCostDelay.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM cost delay");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableCostDelay);
+						pos++;
+					}
+
+					if (!(tableCostLimit.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM cost limit");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableCostLimit);
+						pos++;
+					}
+
+					if (!(tableFreezeMinAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE minimum age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableFreezeMinAge);
+						pos++;
+					}
+
+					if (!(tableFreezeMaxAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE maximum age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableFreezeMaxAge);
+						pos++;
+					}
+
+					if (!(tableFreezeTableAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE table age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, tableFreezeTableAge);
+						pos++;
+					}
+
+					toastTableValue = wxT("true");
+
+					if (!(toastTableVacBaseThr.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM base threshold");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableVacBaseThr);
+						pos++;
+					}
+
+					if (!(toastTableVacFactor.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM scale factor");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableVacFactor);
+						pos++;
+					}
+
+					if (!(toastTableCostDelay.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM cost delay");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableCostDelay);
+						pos++;
+					}
+
+					if (!(toastTableCostLimit.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("VACUUM cost limit");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableCostLimit);
+						pos++;
+					}
+
+					if (!(toastTableFreezeMinAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE minimum age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableFreezeMinAge);
+						pos++;
+					}
+
+					if (!(toastTableFreezeMaxAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE maximum age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableFreezeMaxAge);
+						pos++;
+					}
+
+					if (!(toastTableFreezeTableAge.Cmp(wxT("-1")) == 0))
+					{
+						wxString paramName = wxT("FREEZE table age");
+						lstStorageParam->InsertItem(pos, paramName, 1);
+						lstStorageParam->SetItem(pos, 1, toastTableValue);
+						lstStorageParam->SetItem(pos, 2, toastTableFreezeTableAge);
+						pos++;
+					}
+				}
+
+				wxCommandEvent ev;
+			}
+			else
+			{
+				//If it is normal view edit mode then disable the materialize view checkbox
+				chkMaterializedView->Disable();
+			}
+		}
 	}
 	else
 	{
 		// create mode
+		cboTablespace->Insert(_("<default tablespace>"), 0, (void *)0);
+		cboTablespace->SetSelection(0);
 	}
 
 	// Find, and disable the RULE ACL option if we're 8.2
@@ -160,13 +574,33 @@ wxString dlgView::GetSql()
 		if (name != view->GetName())
 		{
 			if (connection->BackendMinimumVersion(8, 3))
-				AppendNameChange(sql, wxT("VIEW ") + view->GetQuotedFullIdentifier());
+			{
+				if (connection->BackendMinimumVersion(9, 3))
+				{
+					if (view->IsMaterializedView(view->GetSchema()->GetName(),view->GetName()))
+						AppendNameChange(sql, wxT("MATERIALIZED VIEW ") + view->GetQuotedFullIdentifier());
+					else
+						AppendNameChange(sql, wxT("VIEW ") + view->GetQuotedFullIdentifier());
+				}
+				else
+					AppendNameChange(sql, wxT("VIEW ") + view->GetQuotedFullIdentifier());
+			}
 			else
 				AppendNameChange(sql, wxT("TABLE ") + view->GetQuotedFullIdentifier());
 		}
 
 		if (connection->BackendMinimumVersion(8, 4) && cbSchema->GetName() != view->GetSchema()->GetName())
-			AppendSchemaChange(sql, wxT("VIEW " + qtIdent(view->GetSchema()->GetName()) + wxT(".") + qtIdent(name)));
+		{
+			if (connection->BackendMinimumVersion(9, 3))
+			{
+				if (view->IsMaterializedView(view->GetSchema()->GetName(),view->GetName()))
+					AppendSchemaChange(sql, wxT("MATERIALIZED VIEW " + qtIdent(view->GetSchema()->GetName()) + wxT(".") + qtIdent(name)));
+				else
+					AppendSchemaChange(sql, wxT("VIEW " + qtIdent(view->GetSchema()->GetName()) + wxT(".") + qtIdent(name)));
+			}
+			else
+				AppendSchemaChange(sql, wxT("VIEW " + qtIdent(view->GetSchema()->GetName()) + wxT(".") + qtIdent(name)));
+		}
 		else
 			AppendSchemaChange(sql, wxT("TABLE " + qtIdent(view->GetSchema()->GetName()) + wxT(".") + qtIdent(name)));
 	}
@@ -175,11 +609,123 @@ wxString dlgView::GetSql()
 	{
 		name = qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName());
 
-		sql += wxT("CREATE OR REPLACE VIEW ") + name;
+		// Check if user creates the materialized view
+		if (!chkMaterializedView->GetValue())
+			sql += wxT("CREATE OR REPLACE VIEW ") + name;
+		else
+			sql += wxT("CREATE MATERIALIZED VIEW ") + name;
 
 		if (connection->BackendMinimumVersion(9, 2) && chkSecurityBarrier->GetValue())
 			sql += wxT(" WITH (security_barrier=true)");
 
+		//Add the parameter of tablespace and storage parameter to create the materilized view
+		if (connection->BackendMinimumVersion(9, 3) && chkMaterializedView->GetValue())
+		{
+			//check if only checkbox is set not other parameter then not set WITH clause
+			if (lstStorageParam->GetItemCount() != 0 || txtFillFactor->GetValue().Trim().Length() > 0)
+			{
+				//add the parameter one by one
+				sql += wxT("\nWITH (");
+
+				if (txtFillFactor->GetValue().Trim().Length() > 0)
+					sql += wxT("\n  FILLFACTOR = ") + txtFillFactor->GetValue();
+
+				//If any one of the checkbox is enabled then only add
+				if (chkVacEnabled->GetValue() || chkToastVacEnabled->GetValue())
+				{
+					wxString resStr;
+
+					if (chkVacEnabled->GetValue())
+						FillAutoVacuumParameters(sql, resStr, wxT("autovacuum_enabled"), BoolToStr(chkVacEnabled->GetValue()));
+
+					if (chkToastVacEnabled->GetValue())
+						FillAutoVacuumParameters(sql, resStr, wxT("toast.autovacuum_enabled"), BoolToStr(chkToastVacEnabled->GetValue()));
+
+					// Set the parameter value
+					for (long item = 0; item < lstStorageParam->GetItemCount(); item++)
+					{
+						wxString storageParameter,toastTableValue,storageParamValue,resetStr;
+
+						storageParameter = lstStorageParam->GetText(item);
+						toastTableValue = lstStorageParam->GetText(item,1);
+						storageParamValue = lstStorageParam->GetText(item,2);
+
+						if (storageParameter.Cmp(wxT("VACUUM base threshold")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_threshold"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_threshold"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("ANALYZE base threshold")) == 0)
+						{
+							FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_analyze_threshold"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM scale factor")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_scale_factor"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_scale_factor"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("ANALYZE scale factor")) == 0)
+						{
+							FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_analyze_scale_factor"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM cost delay")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_cost_delay"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_cost_delay"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM cost limit")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_cost_limit"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_cost_limit"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE minimum age")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_min_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_min_age"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE maximum age")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_max_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_max_age"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE table age")) == 0)
+						{
+							if (toastTableValue.Cmp(wxT("false")))
+								FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_table_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_table_age"), storageParamValue);
+						}
+					}
+				}
+
+				sql += wxT("\n)\n");
+			}
+
+			if (cboTablespace->GetCurrentSelection() > 0)
+				sql += wxT("\nTABLESPACE ") + qtIdent(cboTablespace->GetValue());
+
+		}
+
 		sql += wxT(" AS\n")
 		       + txtSqlBox->GetText().Trim(true).Trim(false)
 		       + wxT(";\n");
@@ -193,6 +739,205 @@ wxString dlgView::GetSql()
 			else if (!chkSecurityBarrier->GetValue() && view->GetSecurityBarrier() == wxT("true"))
 				sql += wxT("ALTER VIEW ") + name + wxT("\n  SET (security_barrier=false);\n");
 		}
+
+		if (connection->BackendMinimumVersion(9, 3) && chkMaterializedView->GetValue())
+		{
+			if (txtFillFactor->GetValue().Trim().Length() > 0 && txtFillFactor->GetValue() != view->GetFillFactor())
+			{
+				sql += wxT("ALTER MATERIALIZED VIEW ") + name
+					   +  wxT("\n  SET (FILLFACTOR=")
+					   +  txtFillFactor->GetValue() + wxT(");\n");
+			}
+		}
+
+		if (connection->BackendMinimumVersion(9, 3) && chkMaterializedView->GetValue())
+		{
+			wxString setStr;
+			wxString resetStr;
+
+			if (chkVacEnabled->GetValue() || chkToastVacEnabled->GetValue())
+			{
+				bool tableFlag = (view->GetAutoVacuumEnabled() == 1) ? true: false;
+				bool toastTableFlag = (view->GetToastAutoVacuumEnabled() == 1) ? true: false;
+
+				if (chkVacEnabled->GetValue() != tableFlag)
+				{
+					if (chkVacEnabled->GetValue())
+						FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_enabled"), BoolToStr(chkVacEnabled->GetValue()));
+					else
+						FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_enabled"), wxT("-1"));
+				}
+
+				if (chkToastVacEnabled->GetValue() != toastTableFlag)
+				{
+					if (chkToastVacEnabled->GetValue())
+						FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_enabled"), BoolToStr(chkToastVacEnabled->GetValue()));
+					else
+						FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_enabled"), wxT("-1"));
+				}
+
+				//Reset the table parameters if it is removed
+				if (view->GetAutoVacuumVacuumThreshold().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_threshold"), wxT("-1"));
+				if (view->GetAutoVacuumVacuumScaleFactor().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_scale_factor"), wxT("-1"));
+				if (view->GetAutoVacuumAnalyzeThreshold().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_analyze_threshold"), wxT("-1"));
+				if (view->GetAutoVacuumAnalyzeScaleFactor().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_analyze_scale_factor"), wxT("-1"));
+				if (view->GetAutoVacuumVacuumCostDelay().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_cost_delay"), wxT("-1"));
+				if (view->GetAutoVacuumVacuumCostLimit().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_vacuum_cost_limit"), wxT("-1"));
+				if (view->GetAutoVacuumFreezeMaxAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_max_age"), wxT("-1"));
+				if (view->GetAutoVacuumFreezeMinAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_min_age"), wxT("-1"));
+				if (view->GetAutoVacuumFreezeTableAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("autovacuum_freeze_table_age"), wxT("-1"));
+
+
+				//Reset the toast parameters if it is removed
+				if (view->GetToastAutoVacuumVacuumThreshold().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_threshold"), wxT("-1"));
+				if (view->GetToastAutoVacuumVacuumScaleFactor().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_scale_factor"), wxT("-1"));
+				if (view->GetToastAutoVacuumVacuumCostDelay().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_cost_delay"), wxT("-1"));
+				if (view->GetToastAutoVacuumVacuumCostLimit().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_vacuum_cost_limit"), wxT("-1"));
+				if (view->GetToastAutoVacuumFreezeMaxAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_max_age"), wxT("-1"));
+				if (view->GetToastAutoVacuumFreezeMinAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_min_age"), wxT("-1"));
+				if (view->GetToastAutoVacuumFreezeTableAge().Cmp(wxT("")) != 0)
+					FillAutoVacuumParameters(sql, resetStr, wxT("toast.autovacuum_freeze_table_age"), wxT("-1"));
+
+
+				for (long item = 0; item < lstStorageParam->GetItemCount(); item++)
+				{
+						wxString storageParameter,toastTableValue,storageParamValue;
+						wxString toastTableParam = wxT("false");
+
+						storageParameter = lstStorageParam->GetText(item);
+						toastTableValue = lstStorageParam->GetText(item,1);
+						storageParamValue = lstStorageParam->GetText(item,2);
+
+						if (storageParameter.Cmp(wxT("VACUUM base threshold")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_vacuum_threshold"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_vacuum_threshold"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("ANALYZE base threshold")) == 0)
+						{
+							FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_analyze_threshold"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM scale factor")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_vacuum_scale_factor"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_vacuum_scale_factor"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("ANALYZE scale factor")) == 0)
+						{
+							FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_analyze_scale_factor"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM cost delay")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_vacuum_cost_delay"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_vacuum_cost_delay"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("VACUUM cost limit")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_vacuum_cost_limit"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_vacuum_cost_limit"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE minimum age")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_freeze_min_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_freeze_min_age"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE maximum age")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_freeze_max_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_freeze_max_age"), storageParamValue);
+						}
+
+						if (storageParameter.Cmp(wxT("FREEZE table age")) == 0)
+						{
+							if (toastTableValue.Cmp(toastTableParam) == 0)
+								FillAutoVacuumParameters(setStr, resetStr, wxT("autovacuum_freeze_table_age"), storageParamValue);
+							else
+								FillAutoVacuumParameters(setStr, resetStr, wxT("toast.autovacuum_freeze_table_age"), storageParamValue);
+						}
+					}
+				}
+				else
+				{
+					//reset the tabel parameters
+					sql += wxT("ALTER MATERIALIZED VIEW ") + name
+						+  wxT(" RESET(\n")
+						wxT("  autovacuum_enabled,\n")
+						wxT("  autovacuum_vacuum_threshold,\n")
+						wxT("  autovacuum_analyze_threshold,\n")
+						wxT("  autovacuum_vacuum_scale_factor,\n")
+						wxT("  autovacuum_analyze_scale_factor,\n")
+						wxT("  autovacuum_vacuum_cost_delay,\n")
+						wxT("  autovacuum_vacuum_cost_limit,\n")
+						wxT("  autovacuum_freeze_min_age,\n")
+						wxT("  autovacuum_freeze_max_age,\n")
+						wxT("  autovacuum_freeze_table_age\n")
+						wxT(");\n");
+
+					//reset the toast table parameters
+					sql += wxT("ALTER MATERIALIZED VIEW ") + name
+					       +  wxT(" RESET(\n")
+					       wxT("  toast.autovacuum_enabled,\n")
+					       wxT("  toast.autovacuum_vacuum_threshold,\n")
+					       wxT("  toast.autovacuum_analyze_threshold,\n")
+					       wxT("  toast.autovacuum_vacuum_scale_factor,\n")
+					       wxT("  toast.autovacuum_analyze_scale_factor,\n")
+					       wxT("  toast.autovacuum_vacuum_cost_delay,\n")
+					       wxT("  toast.autovacuum_vacuum_cost_limit,\n")
+					       wxT("  toast.autovacuum_freeze_min_age,\n")
+					       wxT("  toast.autovacuum_freeze_max_age,\n")
+					       wxT("  toast.autovacuum_freeze_table_age\n")
+					       wxT(");\n");
+				}
+
+				if (!resetStr.IsEmpty())
+				{
+					sql += wxT("ALTER MATERIALIZED VIEW ") + name + resetStr + wxT("\n);\n");
+				}
+
+				if (!setStr.IsEmpty())
+				{
+					sql += wxT("ALTER MATERIALIZED VIEW ") + name + setStr + wxT("\n);\n");
+				}
+			}
+
+			if (connection->BackendMinimumVersion(9, 3) && chkMaterializedView->GetValue())
+				sql += wxT("ALTER MATERIALIZED VIEW ") + name
+					  +  wxT("\n  SET TABLESPACE ") + qtIdent(cboTablespace->GetValue())
+					  + wxT(";\n");
 	}
 
 	if (view)
@@ -223,3 +968,223 @@ void dlgView::OnChange(wxCommandEvent &event)
 {
 	CheckChange();
 }
+
+void dlgView::OnCheckMaterializedView(wxCommandEvent &ev)
+{
+	if (chkMaterializedView->GetValue())
+	{
+		EnableMaterializeView();
+	}
+	else
+	{
+		DisableMaterializedView();
+	}
+}
+
+void dlgView::OnRadioButtonSelChange(wxCommandEvent &ev)
+{
+	AddRemoveStorageParameter();
+}
+
+void dlgView::EnableMaterializeView()
+{
+	txtFillFactor->Enable();
+	chkVacEnabled->Enable();
+	chkToastVacEnabled->Enable();
+	cboTablespace->Enable();
+}
+
+void dlgView::DisableMaterializedView()
+{
+	txtFillFactor->Disable();
+	txtStorageValue->Disable();
+	lstStorageParam->Disable();
+	cboTablespace->Disable();
+	chkVacEnabled->Disable();
+	chkToastVacEnabled->Disable();
+	cboStorageParam->Disable();
+	radioBtnTable->Disable();
+	radioBtnToastTable->Disable();
+	btnAdd->Disable();
+	btnRemove->Disable();
+}
+
+void dlgView::OnCheckTableVacuum(wxCommandEvent &ev)
+{
+	if (chkVacEnabled->GetValue())
+	{
+		txtStorageValue->Enable();
+		lstStorageParam->Enable();
+		cboStorageParam->Enable();
+		radioBtnTable->Enable();
+		btnAdd->Enable();
+		btnRemove->Enable();
+
+		if (chkToastVacEnabled->GetValue())
+			radioBtnToastTable->Enable();
+		else
+			radioBtnToastTable->Disable();
+	}
+	else
+	{
+		if (chkToastVacEnabled->GetValue())
+		{
+			txtStorageValue->Enable();
+			lstStorageParam->Enable();
+			cboStorageParam->Enable();
+			radioBtnToastTable->Enable();
+			btnAdd->Enable();
+			btnRemove->Enable();
+
+			if (chkVacEnabled->GetValue())
+				radioBtnTable->Enable();
+			else
+				radioBtnTable->Disable();
+		}
+		else
+		{
+			txtStorageValue->Disable();
+			lstStorageParam->Disable();
+			cboStorageParam->Disable();
+			radioBtnTable->Disable();
+			radioBtnToastTable->Disable();
+			btnAdd->Disable();
+			btnRemove->Disable();
+		}
+	}
+}
+
+void dlgView::OnStorageParamListSelChange(wxListEvent &ev)
+{
+
+}
+
+void dlgView::AddRemoveStorageParameter()
+{
+	//Add the storage parameter in combo box
+	if (radioBtnTable->GetValue())
+	{
+		cboStorageParam->Clear();
+		cboStorageParam->Append(wxT("VACUUM base threshold"));
+		cboStorageParam->Append(wxT("ANALYZE base threshold"));
+		cboStorageParam->Append(wxT("VACUUM scale factor"));
+		cboStorageParam->Append(wxT("ANALYZE scale factor"));
+		cboStorageParam->Append(wxT("VACUUM cost delay"));
+		cboStorageParam->Append(wxT("VACUUM cost limit"));
+		cboStorageParam->Append(wxT("FREEZE minimum age"));
+		cboStorageParam->Append(wxT("FREEZE maximum age"));
+		cboStorageParam->Append(wxT("FREEZE table age"));
+	}
+	else
+	{
+		cboStorageParam->Clear();
+		cboStorageParam->Append(wxT("VACUUM base threshold"));
+		cboStorageParam->Append(wxT("VACUUM scale factor"));
+		cboStorageParam->Append(wxT("VACUUM cost delay"));
+		cboStorageParam->Append(wxT("VACUUM cost limit"));
+		cboStorageParam->Append(wxT("FREEZE minimum age"));
+		cboStorageParam->Append(wxT("FREEZE maximum age"));
+		cboStorageParam->Append(wxT("FREEZE table age"));
+	}
+}
+
+long dlgView::storageParameterAvailableinListView()
+{
+	wxString storageParamListView;
+	wxString storageParamComboList;
+	wxString toastTableValue;
+	wxString currentToastTableSel;
+
+	for (long item = 0; item < lstStorageParam->GetItemCount(); item++)
+	{
+		storageParamListView = lstStorageParam->GetText(item);
+		toastTableValue = lstStorageParam->GetText(item,1);
+		storageParamComboList = cboStorageParam->GetValue();
+
+		if (radioBtnToastTable->GetValue())
+			currentToastTableSel = wxT("true");
+		else
+			currentToastTableSel = wxT("false");
+
+		if ((storageParamListView.Cmp(storageParamComboList) == 0 ) && (currentToastTableSel.Cmp(toastTableValue) == 0 ))
+		{
+			return  item;
+		}
+	}
+
+	return -1;
+}
+
+void dlgView::OnAddButtonClicked(wxCommandEvent &ev)
+{
+	//Get all the values from the list and try to add it on the list
+	wxString paramName = cboStorageParam->GetValue();
+	bool toastValue = radioBtnToastTable->GetValue();
+	wxString toastTableValue;
+	if (toastValue)
+		toastTableValue = wxT("true");
+	else
+		toastTableValue = wxT("false");
+
+	wxString paramValue = txtStorageValue->GetValue();
+
+	long pos = storageParameterAvailableinListView();
+
+	if (pos == -1)
+	{
+		long pos = lstStorageParam->GetItemCount();
+		lstStorageParam->InsertItem(pos, paramName, 1);
+		lstStorageParam->SetItem(pos, 1, toastTableValue);
+		lstStorageParam->SetItem(pos, 2, paramValue);
+	}
+	else
+	{
+		lstStorageParam->DeleteItem(pos);
+		lstStorageParam->InsertItem(pos, paramName, 1);
+		lstStorageParam->SetItem(pos, 1, toastTableValue);
+		lstStorageParam->SetItem(pos, 2, paramValue);
+
+	}
+}
+
+void dlgView::OnRemoveButtonClicked(wxCommandEvent &ev)
+{
+	if (lstStorageParam->GetSelection() == wxNOT_FOUND)
+		return;
+	lstStorageParam->DeleteCurrentItem();
+}
+
+void dlgView::FillAutoVacuumParameters(wxString &setStr, wxString &resetStr,
+                                        const wxString &parameter, const wxString &val)
+{
+	if (val == wxT("-1"))
+	{
+		if (resetStr.IsEmpty())
+			resetStr = wxT(" RESET (");
+		else
+			resetStr += wxT(",");
+		resetStr += wxT("\n  ") + parameter;
+	}
+	else
+	{
+		if (setStr.IsEmpty())
+			setStr = wxT(" SET (");
+		else
+			setStr += wxT(",");
+		setStr += wxT("\n  ") + parameter + wxT(" = ") + val;
+	}
+}
+
+wxString dlgView::AppendNum(bool &changed, wxTextCtrl *ctl, wxString val)
+{
+	wxString str = ctl->GetValue();
+	if (str.IsEmpty() || str.StartsWith(wxT("-")))
+		str = wxT("-1");
+
+	changed |= (str != val);
+	return str;
+}
+
+void dlgView::OnChangeVacuum(wxCommandEvent &ev)
+{
+}
diff --git a/pgadmin/include/dlg/dlgView.h b/pgadmin/include/dlg/dlgView.h
index e8f580a..2c8a3aa 100644
--- a/pgadmin/include/dlg/dlgView.h
+++ b/pgadmin/include/dlg/dlgView.h
@@ -39,14 +39,47 @@ public:
 private:
 
 	virtual bool IsUpToDate();
+	void OnChangeVacuum(wxCommandEvent &ev);
+	void OnCheckMaterializedView(wxCommandEvent &ev);
+	void OnStorageParamListSelChange(wxListEvent &ev);
+	void OnRadioButtonSelChange(wxCommandEvent &ev);
+	void OnAddButtonClicked(wxCommandEvent &ev);
+	void OnRemoveButtonClicked(wxCommandEvent &ev);
+	void OnCheckTableVacuum(wxCommandEvent &ev);
+	void EnableMaterializeView();
+	void DisableMaterializedView();
+	void AddRemoveStorageParameter();
+	long storageParameterAvailableinListView();
+	void FillAutoVacuumParameters(wxString &setStr, wxString &resetStr,const wxString &parameter, const wxString &val);
+	wxString AppendNum(bool &changed, wxTextCtrl *ctl, wxString val);
+
 
 	pgSchema *schema;
 	pgView *view;
 	ctlSeclabelPanel *seclabelPage;
 	wxString oldDefinition;
+	wxTextValidator mviewNumericValidator;
 
 	void OnChange(wxCommandEvent &event);
 
+	bool tableVacEnabled, hasVacuum, settingAutoVacuum;
+	wxString settingVacBaseThr, settingAnlBaseThr, settingCostDelay,
+	         settingCostLimit, settingFreezeMinAge, settingFreezeMaxAge,
+	         settingFreezeTableAge;
+	wxString tableVacBaseThr, tableAnlBaseThr, tableCostDelay,
+	         tableCostLimit, tableFreezeMinAge, tableFreezeMaxAge,
+	         tableFreezeTableAge;
+	wxString settingVacFactor, settingAnlFactor;
+	wxString tableVacFactor, tableAnlFactor;
+
+	/* Toast Table */
+	bool toastTableVacEnabled, toastTableHasVacuum;
+	wxString toastTableVacBaseThr,
+	         toastTableCostDelay, toastTableCostLimit,
+	         toastTableFreezeMinAge, toastTableFreezeMaxAge,
+	         toastTableFreezeTableAge;
+	wxString toastTableVacFactor;
+
 	DECLARE_EVENT_TABLE()
 };
 
diff --git a/pgadmin/include/schema/pgView.h b/pgadmin/include/schema/pgView.h
index 28c9511..3f45a74 100644
--- a/pgadmin/include/schema/pgView.h
+++ b/pgadmin/include/schema/pgView.h
@@ -75,6 +75,23 @@ public:
 		security_barrier = s;
 	}
 
+	wxString GetTablespace() const
+	{
+		return tablespace;
+	}
+	void iSetTablespace(const wxString &newVal)
+	{
+		tablespace = newVal;
+	}
+	OID GetTablespaceOid() const
+	{
+		return tablespaceOid;
+	}
+	void iSetTablespaceOid(const OID newVal)
+	{
+		tablespaceOid = newVal;
+	}
+
 	wxMenu *GetNewMenu();
 	wxString GetSql(ctlTree *browser);
 	wxString GetSelectSql(ctlTree *browser);
@@ -103,11 +120,221 @@ public:
 
 	bool IsUpToDate();
 
+	wxString GetFillFactor()
+	{
+		return fillFactor;
+	}
+	void iSetFillFactor(const wxString &s)
+	{
+		fillFactor = s;
+	}
+
+	bool GetCustomAutoVacuumEnabled()
+	{
+		return !reloptions.IsEmpty();
+	}
+	wxString GetRelOptions()
+	{
+		return reloptions;
+	}
+	void iSetRelOptions(const wxString &s)
+	{
+		reloptions = s;
+	}
+	int GetAutoVacuumEnabled()
+	{
+		return autovacuum_enabled;
+	}
+	void iSetAutoVacuumEnabled(int i)
+	{
+		autovacuum_enabled = i;
+	}
+	wxString GetAutoVacuumVacuumThreshold()
+	{
+		return autovacuum_vacuum_threshold;
+	}
+	void iSetAutoVacuumVacuumThreshold(const wxString &s)
+	{
+		autovacuum_vacuum_threshold = s;
+	}
+	wxString GetAutoVacuumVacuumScaleFactor()
+	{
+		return autovacuum_vacuum_scale_factor;
+	}
+	void iSetAutoVacuumVacuumScaleFactor(const wxString &s)
+	{
+		autovacuum_vacuum_scale_factor = s;
+	}
+	wxString GetAutoVacuumAnalyzeThreshold()
+	{
+		return autovacuum_analyze_threshold;
+	}
+	void iSetAutoVacuumAnalyzeThreshold(const wxString &s)
+	{
+		autovacuum_analyze_threshold = s;
+	}
+	wxString GetAutoVacuumAnalyzeScaleFactor()
+	{
+		return autovacuum_analyze_scale_factor;
+	}
+	void iSetAutoVacuumAnalyzeScaleFactor(const wxString &s)
+	{
+		autovacuum_analyze_scale_factor = s;
+	}
+	wxString GetAutoVacuumVacuumCostDelay()
+	{
+		return autovacuum_vacuum_cost_delay;
+	}
+	void iSetAutoVacuumVacuumCostDelay(const wxString &s)
+	{
+		autovacuum_vacuum_cost_delay = s;
+	}
+	wxString GetAutoVacuumVacuumCostLimit()
+	{
+		return autovacuum_vacuum_cost_limit;
+	}
+	void iSetAutoVacuumVacuumCostLimit(const wxString &s)
+	{
+		autovacuum_vacuum_cost_limit = s;
+	}
+	wxString GetAutoVacuumFreezeMinAge()
+	{
+		return autovacuum_freeze_min_age;
+	}
+	void iSetAutoVacuumFreezeMinAge(const wxString &s)
+	{
+		autovacuum_freeze_min_age = s;
+	}
+	wxString GetAutoVacuumFreezeMaxAge()
+	{
+		return autovacuum_freeze_max_age;
+	}
+	void iSetAutoVacuumFreezeMaxAge(const wxString &s)
+	{
+		autovacuum_freeze_max_age = s;
+	}
+	wxString GetAutoVacuumFreezeTableAge()
+	{
+		return autovacuum_freeze_table_age;
+	}
+	void iSetAutoVacuumFreezeTableAge(const wxString &s)
+	{
+		autovacuum_freeze_table_age = s;
+	}
+	bool GetHasToastTable()
+	{
+		return hasToastTable;
+	}
+	void iSetHasToastTable(bool b)
+	{
+		hasToastTable = b;
+	}
+
+	/* TOAST TABLE autovacuum settings */
+	bool GetToastCustomAutoVacuumEnabled()
+	{
+		return !toast_reloptions.IsEmpty();
+	}
+	wxString GetToastRelOptions()
+	{
+		return toast_reloptions;
+	}
+	void iSetToastRelOptions(const wxString &s)
+	{
+		toast_reloptions = s;
+	}
+	int GetToastAutoVacuumEnabled()
+	{
+		return toast_autovacuum_enabled;
+	}
+	void iSetToastAutoVacuumEnabled(int i)
+	{
+		toast_autovacuum_enabled = i;
+	}
+	wxString GetToastAutoVacuumVacuumThreshold()
+	{
+		return toast_autovacuum_vacuum_threshold;
+	}
+	void iSetToastAutoVacuumVacuumThreshold(const wxString &s)
+	{
+		toast_autovacuum_vacuum_threshold = s;
+	}
+	wxString GetToastAutoVacuumVacuumScaleFactor()
+	{
+		return toast_autovacuum_vacuum_scale_factor;
+	}
+	void iSetToastAutoVacuumVacuumScaleFactor(const wxString &s)
+	{
+		toast_autovacuum_vacuum_scale_factor = s;
+	}
+	wxString GetToastAutoVacuumVacuumCostDelay()
+	{
+		return toast_autovacuum_vacuum_cost_delay;
+	}
+	void iSetToastAutoVacuumVacuumCostDelay(const wxString &s)
+	{
+		toast_autovacuum_vacuum_cost_delay = s;
+	}
+	wxString GetToastAutoVacuumVacuumCostLimit()
+	{
+		return toast_autovacuum_vacuum_cost_limit;
+	}
+	void iSetToastAutoVacuumVacuumCostLimit(const wxString &s)
+	{
+		toast_autovacuum_vacuum_cost_limit = s;
+	}
+	wxString GetToastAutoVacuumFreezeMinAge()
+	{
+		return toast_autovacuum_freeze_min_age;
+	}
+	void iSetToastAutoVacuumFreezeMinAge(const wxString &s)
+	{
+		toast_autovacuum_freeze_min_age = s;
+	}
+	wxString GetToastAutoVacuumFreezeMaxAge()
+	{
+		return toast_autovacuum_freeze_max_age;
+	}
+	void iSetToastAutoVacuumFreezeMaxAge(const wxString &s)
+	{
+		toast_autovacuum_freeze_max_age = s;
+	}
+	wxString GetToastAutoVacuumFreezeTableAge()
+	{
+		return toast_autovacuum_freeze_table_age;
+	}
+	void iSetToastAutoVacuumFreezeTableAge(const wxString &s)
+	{
+		toast_autovacuum_freeze_table_age = s;
+	}
+
+	bool IsMaterializedView(wxString schemaName, wxString viewName);
+
 private:
 	wxString GetCols(ctlTree *browser, size_t indent, wxString &QMs, bool withQM);
 	void AppendStuff(wxString &sql, ctlTree *browser, pgaFactory &factory);
+	bool IsMaterializedView(ctlTree *browser);
 	bool hasInsertRule, hasUpdateRule, hasDeleteRule;
 	wxString security_barrier;
+
+	int autovacuum_enabled, toast_autovacuum_enabled;
+	wxString reloptions, toast_reloptions;
+
+	wxString fillFactor, autovacuum_vacuum_threshold,
+	         autovacuum_vacuum_scale_factor, autovacuum_analyze_threshold,
+	         autovacuum_analyze_scale_factor, autovacuum_vacuum_cost_delay,
+	         autovacuum_vacuum_cost_limit, autovacuum_freeze_min_age,
+	         autovacuum_freeze_max_age, autovacuum_freeze_table_age;
+
+	wxString toast_fillFactor, toast_autovacuum_vacuum_threshold,
+	         toast_autovacuum_vacuum_scale_factor, toast_autovacuum_vacuum_cost_delay,
+	         toast_autovacuum_vacuum_cost_limit, toast_autovacuum_freeze_min_age,
+	         toast_autovacuum_freeze_max_age, toast_autovacuum_freeze_table_age;
+
+	wxString tablespace;
+	bool hasToastTable;
+	OID tablespaceOid;
+
 };
 
 class pgViewCollection : public pgSchemaObjCollection
diff --git a/pgadmin/schema/pgView.cpp b/pgadmin/schema/pgView.cpp
index d98d5d1..a44ff62 100644
--- a/pgadmin/schema/pgView.cpp
+++ b/pgadmin/schema/pgView.cpp
@@ -118,7 +118,11 @@ wxMenu *pgView::GetNewMenu()
 
 bool pgView::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
 {
-	wxString sql = wxT("DROP VIEW ") + this->GetSchema()->GetQuotedIdentifier() + wxT(".") + this->GetQuotedIdentifier();
+	if (IsMaterializedView(browser))
+		sql = wxT("DROP MATERIALIZED VIEW ") + this->GetSchema()->GetQuotedIdentifier() + wxT(".") + this->GetQuotedIdentifier();
+	else
+		sql = wxT("DROP VIEW ") + this->GetSchema()->GetQuotedIdentifier() + wxT(".") + this->GetQuotedIdentifier();
+
 	if (cascaded)
 		sql += wxT(" CASCADE");
 	return GetDatabase()->ExecuteVoid(sql);
@@ -129,11 +133,116 @@ wxString pgView::GetSql(ctlTree *browser)
 {
 	if (sql.IsNull())
 	{
-		sql = wxT("-- View: ") + GetQuotedFullIdentifier() + wxT("\n\n")
-		      + wxT("-- DROP VIEW ") + GetQuotedFullIdentifier() + wxT(";")
-		      + wxT("\n\nCREATE OR REPLACE VIEW ") + GetQuotedFullIdentifier();
-		if (GetConnection()->BackendMinimumVersion(9, 2) && GetSecurityBarrier().Length() > 0)
-			sql += wxT(" WITH (security_barrier=") + GetSecurityBarrier() + wxT(")");
+		if (!IsMaterializedView(browser))
+		{
+			sql = wxT("-- View: ") + GetQuotedFullIdentifier() + wxT("\n\n")
+			      + wxT("-- DROP VIEW ") + GetQuotedFullIdentifier() + wxT(";")
+			      + wxT("\n\nCREATE OR REPLACE VIEW ") + GetQuotedFullIdentifier();
+
+			if (GetConnection()->BackendMinimumVersion(9, 2) && GetSecurityBarrier().Length() > 0)
+				sql += wxT(" WITH (security_barrier=") + GetSecurityBarrier() + wxT(")");
+		}
+		else
+		{
+			sql = wxT("-- MATERIALIZED View: ") + GetQuotedFullIdentifier() + wxT("\n\n")
+			      + wxT("-- DROP MATERIALIZED VIEW ") + GetQuotedFullIdentifier() + wxT(";")
+			      + wxT("\n\nCREATE MATERIALIZED VIEW ") + GetQuotedFullIdentifier();
+
+			if (GetConnection()->BackendMinimumVersion(9, 3))
+			{
+				//check if fill factor and storage parameter
+				if (GetFillFactor().Length() > 0 || GetAutoVacuumEnabled() == 1 || GetToastAutoVacuumEnabled() == 1)
+				{
+					sql += wxT("\nWITH (");
+					if (GetFillFactor().Length() > 0)
+						sql += wxT("\n  FILLFACTOR=") + GetFillFactor();
+
+					if(GetConnection()->BackendMinimumVersion(9, 3))
+					{
+							if (GetAutoVacuumEnabled() == 1)
+								sql += wxT(",\n  autovacuum_enabled=true");
+							else if (GetAutoVacuumEnabled() == 0)
+								sql += wxT(",\n  autovacuum_enabled=false");
+
+							if (!GetAutoVacuumVacuumThreshold().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_vacuum_threshold=") + GetAutoVacuumVacuumThreshold();
+							}
+							if (!GetAutoVacuumVacuumScaleFactor().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_vacuum_scale_factor=") + GetAutoVacuumVacuumScaleFactor();
+							}
+							if (!GetAutoVacuumAnalyzeThreshold().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_analyze_threshold=") + GetAutoVacuumAnalyzeThreshold();
+							}
+							if (!GetAutoVacuumAnalyzeScaleFactor().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_analyze_scale_factor=") + GetAutoVacuumAnalyzeScaleFactor();
+							}
+							if (!GetAutoVacuumVacuumCostDelay().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_vacuum_cost_delay=") + GetAutoVacuumVacuumCostDelay();
+							}
+							if (!GetAutoVacuumVacuumCostLimit().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_vacuum_cost_limit=") + GetAutoVacuumVacuumCostLimit();
+							}
+							if (!GetAutoVacuumFreezeMinAge().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_freeze_min_age=") + GetAutoVacuumFreezeMinAge();
+							}
+							if (!GetAutoVacuumFreezeMaxAge().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_freeze_max_age=") + GetAutoVacuumFreezeMaxAge();
+							}
+							if (!GetAutoVacuumFreezeTableAge().IsEmpty())
+							{
+								sql += wxT(",\n  autovacuum_freeze_table_age=") + GetAutoVacuumFreezeTableAge();
+							}
+
+							if (GetToastAutoVacuumEnabled() == 1)
+								sql += wxT(",\n  toast.autovacuum_enabled=true");
+							else if (GetToastAutoVacuumEnabled() == 0)
+								sql += wxT(",\n  toast.autovacuum_enabled=false");
+
+							if (!GetToastAutoVacuumVacuumThreshold().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_vacuum_threshold=") + GetToastAutoVacuumVacuumThreshold();
+							}
+							if (!GetToastAutoVacuumVacuumScaleFactor().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_vacuum_scale_factor=") + GetToastAutoVacuumVacuumScaleFactor();
+							}
+							if (!GetToastAutoVacuumVacuumCostDelay().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_vacuum_cost_delay=") + GetToastAutoVacuumVacuumCostDelay();
+							}
+							if (!GetToastAutoVacuumVacuumCostLimit().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_vacuum_cost_limit=") + GetToastAutoVacuumVacuumCostLimit();
+							}
+							if (!GetToastAutoVacuumFreezeMinAge().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_freeze_min_age=") + GetToastAutoVacuumFreezeMinAge();
+							}
+							if (!GetToastAutoVacuumFreezeMaxAge().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_freeze_max_age=") + GetToastAutoVacuumFreezeMaxAge();
+							}
+							if (!GetToastAutoVacuumFreezeTableAge().IsEmpty())
+							{
+								sql += wxT(",\n  toast.autovacuum_freeze_table_age=") + GetToastAutoVacuumFreezeTableAge();
+							}
+					}
+					sql += wxT("\n)");
+				}
+			}
+
+			if (GetConnection()->BackendMinimumVersion(9, 3) && tablespace != GetDatabase()->GetDefaultTablespace())
+				sql += wxT("\nTABLESPACE ") + qtIdent(tablespace);
+		}
+
 		sql += wxT(" AS \n")
 		       + GetFormattedDefinition()
 		       + wxT("\n\n")
@@ -309,6 +418,66 @@ void pgView::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *proper
 		if (GetConnection()->BackendMinimumVersion(9, 2) && GetSecurityBarrier().Length() > 0)
 			properties->AppendItem(_("Security barrier?"), GetSecurityBarrier());
 
+		if (GetConnection()->BackendMinimumVersion(9, 3))
+			properties->AppendYesNoItem(_("Materialized view?"), IsMaterializedView(browser));
+
+		/* Custom AutoVacuum Settings */
+		if (GetConnection()->BackendMinimumVersion(9, 3) && IsMaterializedView(browser))
+		{
+			if (!GetFillFactor().IsEmpty())
+				properties->AppendItem(_("Fill factor"), GetFillFactor());
+
+			if (GetAutoVacuumEnabled() != 2)
+			{
+				properties->AppendItem(_("Table auto-vacuum enabled?"), GetAutoVacuumEnabled() == 1 ? _("Yes") : _("No"));
+			}
+
+			if (!GetAutoVacuumVacuumThreshold().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum VACUUM base threshold"), GetAutoVacuumVacuumThreshold());
+			if (!GetAutoVacuumVacuumScaleFactor().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum VACUUM scale factor"), GetAutoVacuumVacuumScaleFactor());
+			if (!GetAutoVacuumAnalyzeThreshold().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum ANALYZE base threshold"), GetAutoVacuumAnalyzeThreshold());
+			if (!GetAutoVacuumAnalyzeScaleFactor().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum ANALYZE scale factor"), GetAutoVacuumAnalyzeScaleFactor());
+			if (!GetAutoVacuumVacuumCostDelay().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum VACUUM cost delay"), GetAutoVacuumVacuumCostDelay());
+			if (!GetAutoVacuumVacuumCostLimit().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum VACUUM cost limit"), GetAutoVacuumVacuumCostLimit());
+			if (!GetAutoVacuumFreezeMinAge().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum FREEZE minimum age"), GetAutoVacuumFreezeMinAge());
+			if (!GetAutoVacuumFreezeMaxAge().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum FREEZE maximum age"), GetAutoVacuumFreezeMaxAge());
+			if (!GetAutoVacuumFreezeTableAge().IsEmpty())
+				properties->AppendItem(_("Table auto-vacuum FREEZE table age"), GetAutoVacuumFreezeTableAge());
+		}
+
+		/* Custom TOAST-TABLE AutoVacuum Settings */
+		if (GetConnection()->BackendMinimumVersion(9, 3) && IsMaterializedView(browser) && GetHasToastTable())
+		{
+			if (GetToastAutoVacuumEnabled() != 2)
+			{
+				properties->AppendItem(_("Toast auto-vacuum enabled?"), GetToastAutoVacuumEnabled() == 1 ? _("Yes") : _("No"));
+			}
+			if (!GetToastAutoVacuumVacuumThreshold().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum VACUUM base threshold"), GetToastAutoVacuumVacuumThreshold());
+			if (!GetToastAutoVacuumVacuumScaleFactor().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum VACUUM scale factor"), GetToastAutoVacuumVacuumScaleFactor());
+			if (!GetToastAutoVacuumVacuumCostDelay().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum VACUUM cost delay"), GetToastAutoVacuumVacuumCostDelay());
+			if (!GetToastAutoVacuumVacuumCostLimit().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum VACUUM cost limit"), GetToastAutoVacuumVacuumCostLimit());
+			if (!GetToastAutoVacuumFreezeMinAge().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum FREEZE minimum age"), GetToastAutoVacuumFreezeMinAge());
+			if (!GetToastAutoVacuumFreezeMaxAge().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum FREEZE maximum age"), GetToastAutoVacuumFreezeMaxAge());
+			if (!GetToastAutoVacuumFreezeTableAge().IsEmpty())
+				properties->AppendItem(_("Toast auto-vacuum FREEZE table age"), GetToastAutoVacuumFreezeTableAge());
+		}
+
+		if (GetConnection()->BackendMinimumVersion(9, 3) && IsMaterializedView(browser))
+			properties->AppendItem(_("Tablespace"), tablespace);
+
 		if (!GetLabels().IsEmpty())
 		{
 			wxArrayString seclabels = GetProviderLabelArray();
@@ -375,6 +544,25 @@ void pgView::AppendStuff(wxString &sql, ctlTree *browser, pgaFactory &factory)
 		sql += tmp;
 }
 
+bool pgView::IsMaterializedView(ctlTree *browser)
+{
+	wxString sql = wxT("SELECT count(*) FROM pg_matviews WHERE matviewname = ") + qtDbString(this->GetQuotedFullIdentifier()) + wxT(" AND schemaname = ") + qtDbString(this->GetSchema()->GetQuotedIdentifier());
+
+    if (!this->GetDatabase()->GetConnection() || this->GetDatabase()->ExecuteScalar(sql) == wxT("0"))
+            return false;
+    else
+            return true;
+}
+
+bool pgView::IsMaterializedView(wxString schemaName, wxString viewName)
+{
+	wxString sql = wxT("SELECT count(*) FROM pg_matviews WHERE matviewname = ") + qtDbString(viewName) + wxT(" AND schemaname = ") + qtDbString(schemaName);
+
+    if (!this->GetDatabase()->GetConnection() || this->GetDatabase()->ExecuteScalar(sql) == wxT("0"))
+            return false;
+    else
+            return true;
+}
 
 ///////////////////////////////////////////////////
 
@@ -415,7 +603,7 @@ wxString pgViewCollection::GetTranslatedMessage(int kindOfMessage) const
 pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restriction)
 {
 	pgView *view = 0;
-	wxString sql = wxT("SELECT c.oid, c.xmin, c.relname, pg_get_userbyid(c.relowner) AS viewowner, c.relacl, description, ")
+	wxString sql = wxT("SELECT c.oid, c.xmin, c.relname,c.reltablespace AS spcoid,spc.spcname, pg_get_userbyid(c.relowner) AS viewowner, c.relacl, description, ")
 	               wxT("pg_get_viewdef(c.oid") + collection->GetDatabase()->GetPrettyOption() + wxT(") AS definition");
 	if (collection->GetDatabase()->BackendMinimumVersion(9, 1))
 	{
@@ -426,13 +614,50 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
 	{
 		sql += wxT(",\nsubstring(array_to_string(c.reloptions, ',') FROM 'security_barrier=([a-z|0-9]*)') AS security_barrier");
 	}
+
+	if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+			sql += wxT(", substring(array_to_string(c.reloptions, ',') FROM 'fillfactor=([0-9]*)') AS fillfactor \n");
+
+	if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+	{
+			sql += wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') AS autovacuum_enabled \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_freeze_max_age=([0-9]*)') AS autovacuum_freeze_max_age \n")
+			         wxT(", substring(array_to_string(c.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS autovacuum_freeze_table_age \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') AS toast_autovacuum_enabled \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_max_age=([0-9]*)') AS toast_autovacuum_freeze_max_age \n")
+			         wxT(", substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age \n")
+			         wxT(", c.reloptions AS reloptions, tst.reloptions AS toast_reloptions \n")
+			         wxT(", (CASE WHEN c.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable\n");
+	}
+
+
 	sql += wxT("\n  FROM pg_class c\n")
-	       wxT("  LEFT OUTER JOIN pg_description des ON (des.objoid=c.oid and des.objsubid=0 AND des.classoid='pg_class'::regclass)\n")
-	       wxT(" WHERE ((c.relhasrules AND (EXISTS (\n")
+		   wxT("  LEFT OUTER JOIN pg_tablespace spc on spc.oid=c.reltablespace\n")
+	       wxT("  LEFT OUTER JOIN pg_description des ON (des.objoid=c.oid and des.objsubid=0 AND des.classoid='pg_class'::regclass)\n");
+
+	// Add the toast table for vacuum parameters.
+	if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+		sql += wxT("  LEFT OUTER JOIN pg_class tst ON tst.oid = c.reltoastrelid\n");
+
+	sql += wxT(" WHERE ((c.relhasrules AND (EXISTS (\n")
 	       wxT("           SELECT r.rulename FROM pg_rewrite r\n")
 	       wxT("            WHERE ((r.ev_class = c.oid)\n")
 	       wxT("              AND (bpchar(r.ev_type) = '1'::bpchar)) ))) OR (c.relkind = 'v'::char))\n")
-	       wxT("   AND relnamespace = ") + collection->GetSchema()->GetOidStr() + wxT("\n")
+	       wxT("   AND c.relnamespace = ") + collection->GetSchema()->GetOidStr() + wxT("\n")
 	       + restriction
 	       + wxT(" ORDER BY relname");
 
@@ -460,6 +685,71 @@ pgObject *pgViewFactory::CreateObjects(pgCollection *collection, ctlTree *browse
 			{
 				view->iSetSecurityBarrier(views->GetVal(wxT("security_barrier")));
 			}
+
+			if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+			{
+				view->iSetFillFactor(views->GetVal(wxT("fillfactor")));
+			}
+
+			if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+			{
+				if (views->GetOid(wxT("spcoid")) == 0)
+					view->iSetTablespaceOid(collection->GetDatabase()->GetTablespaceOid());
+				else
+					view->iSetTablespaceOid(views->GetOid(wxT("spcoid")));
+			}
+
+			if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+			{
+					view->iSetRelOptions(views->GetVal(wxT("reloptions")));
+
+					if (views->GetVal(wxT("autovacuum_enabled")).IsEmpty())
+						view->iSetAutoVacuumEnabled(2);
+					else if (views->GetBool(wxT("autovacuum_enabled")))
+						view->iSetAutoVacuumEnabled(1);
+					else
+						view->iSetAutoVacuumEnabled(0);
+					view->iSetAutoVacuumVacuumThreshold(views->GetVal(wxT("autovacuum_vacuum_threshold")));
+					view->iSetAutoVacuumVacuumScaleFactor(views->GetVal(wxT("autovacuum_vacuum_scale_factor")));
+					view->iSetAutoVacuumAnalyzeThreshold(views->GetVal(wxT("autovacuum_analyze_threshold")));
+					view->iSetAutoVacuumAnalyzeScaleFactor(views->GetVal(wxT("autovacuum_analyze_scale_factor")));
+					view->iSetAutoVacuumVacuumCostDelay(views->GetVal(wxT("autovacuum_vacuum_cost_delay")));
+					view->iSetAutoVacuumVacuumCostLimit(views->GetVal(wxT("autovacuum_vacuum_cost_limit")));
+					view->iSetAutoVacuumFreezeMinAge(views->GetVal(wxT("autovacuum_freeze_min_age")));
+					view->iSetAutoVacuumFreezeMaxAge(views->GetVal(wxT("autovacuum_freeze_max_age")));
+					view->iSetAutoVacuumFreezeTableAge(views->GetVal(wxT("autovacuum_freeze_table_age")));
+
+					view->iSetHasToastTable(views->GetBool(wxT("hastoasttable")));
+
+				if (view->GetHasToastTable())
+				{
+					view->iSetToastRelOptions(views->GetVal(wxT("toast_reloptions")));
+
+					if (views->GetVal(wxT("toast_autovacuum_enabled")).IsEmpty())
+						view->iSetToastAutoVacuumEnabled(2);
+					else if (views->GetBool(wxT("toast_autovacuum_enabled")))
+						view->iSetToastAutoVacuumEnabled(1);
+					else
+						view->iSetToastAutoVacuumEnabled(0);
+
+					view->iSetToastAutoVacuumVacuumThreshold(views->GetVal(wxT("toast_autovacuum_vacuum_threshold")));
+					view->iSetToastAutoVacuumVacuumScaleFactor(views->GetVal(wxT("toast_autovacuum_vacuum_scale_factor")));
+					view->iSetToastAutoVacuumVacuumCostDelay(views->GetVal(wxT("toast_autovacuum_vacuum_cost_delay")));
+					view->iSetToastAutoVacuumVacuumCostLimit(views->GetVal(wxT("toast_autovacuum_vacuum_cost_limit")));
+					view->iSetToastAutoVacuumFreezeMinAge(views->GetVal(wxT("toast_autovacuum_freeze_min_age")));
+					view->iSetToastAutoVacuumFreezeMaxAge(views->GetVal(wxT("toast_autovacuum_freeze_max_age")));
+					view->iSetToastAutoVacuumFreezeTableAge(views->GetVal(wxT("toast_autovacuum_freeze_table_age")));
+				}
+			}
+
+			if (collection->GetConnection()->BackendMinimumVersion(9, 3))
+			{
+				if (views->GetVal(wxT("spcname")) == wxEmptyString)
+					view->iSetTablespace(collection->GetDatabase()->GetTablespace());
+				else
+					view->iSetTablespace(views->GetVal(wxT("spcname")));
+			}
+
 			if (browser)
 			{
 				collection->AppendBrowserItem(browser, view);
diff --git a/pgadmin/ui/dlgView.xrc b/pgadmin/ui/dlgView.xrc
index bb83c2d..292afa3 100644
--- a/pgadmin/ui/dlgView.xrc
+++ b/pgadmin/ui/dlgView.xrc
@@ -150,6 +150,204 @@
               </object>
             </object>
           </object>
+          <object class="notebookpage">
+            <label>Materialized View</label>
+            <object class="wxPanel" name="pnlMaterializedView">
+              <object class="wxFlexGridSizer">
+                <cols>1</cols>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <rows>3</rows>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stMaterializedView">
+                        <label>Materialized View</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxCheckBox" name="chkMaterializedView">
+                        <label></label>
+                        <checked>0</checked>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stTableSpace">
+                        <label>Tablespace</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxComboBox" name="cboTablespace">
+                        <content/>
+                        <style>wxCB_DROPDOWN</style>
+                      </object>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stFillFactor">
+                        <label>Fill Factor</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxTextCtrl" name="txtFillFactor"/>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                    </object>
+                    <vgap>2</vgap>
+                    <hgap>1</hgap>
+                    <growablecols>1</growablecols>
+                    <growablerows>3</growablerows>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stVacEnabled">
+                        <label>Table - Vacuum Enable</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxCheckBox" name="chkVacEnabled">
+                        <label></label>
+                        <checked>0</checked>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxStaticText" name="stToastVacEnabled">
+                        <label>Toast Table - Vacuum Enable</label>
+                      </object>
+                      <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxCheckBox" name="chkToastVacEnabled">
+                        <label></label>
+                        <checked>0</checked>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                  </object>
+                  <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                  <border>4</border>
+                </object>
+                <rows>6</rows>
+                <vgap>1</vgap>
+                <hgap>1</hgap>
+                <object class="sizeritem">
+                  <object class="wxStaticBoxSizer">
+                    <label>Storage Parameter</label>
+                    <orient>wxVERTICAL</orient>
+                    <object class="sizeritem">
+                      <object class="wxListCtrl" name="lstStorageParam">
+                        <style>wxLC_REPORT|wxLC_SINGLE_SEL</style>
+                      </object>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                      <minsize>100,65d</minsize>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxFlexGridSizer">
+                        <cols>2</cols>
+                        <rows>1</rows>
+                        <object class="sizeritem">
+                          <object class="wxRadioButton" name="radioBtnTable">
+                            <label>Table</label>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="wxRadioButton" name="radioBtnToastTable">
+                            <label>Toast Table</label>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                      </object>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxFlexGridSizer">
+                        <cols>2</cols>
+                        <rows>2</rows>
+                        <object class="sizeritem">
+                          <object class="wxStaticText" name="stStorageParam">
+                            <label>Storage Parameter</label>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="wxComboBox" name="cboStorageParam">
+                            <content/>
+                            <style>wxCB_DROPDOWN</style>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="wxStaticText" name="stStorageValue">
+                            <label>Value</label>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="wxTextCtrl" name="txtStorageValue">
+                            <style></style>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <vgap>4</vgap>
+                        <hgap>4</hgap>
+                        <growablecols>1</growablecols>
+                        <growablerows>3</growablerows>
+                      </object>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxFlexGridSizer">
+                        <cols>2</cols>
+                        <rows>1</rows>
+                        <object class="sizeritem">
+                          <object class="wxButton" name="btnAdd">
+                            <label>Add</label>
+                            <style></style>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="wxButton" name="btnRemove">
+                            <label>Remove</label>
+                          </object>
+                          <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                          <border>4</border>
+                        </object>
+                      </object>
+                      <flag>wxTOP|wxLEFT|wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
+                      <border>4</border>
+                    </object>
+                  </object>
+                  <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>
+                  <border>4</border>
+                </object>
+                <growablecols>0</growablecols>
+              </object>
+            </object>
+          </object>
         </object>
         <flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
         <border>3</border>
