Deleting dbo.ReportTemp to reduce fresh database size

What does the table ReportTemp do?

It is not deleted when running the default Clear Database task. I tried deleting the data in dbo.ReportTemp and it reduced the backup database size from over 100mb to just 2.7mb. I also haven’t encountered any issues with using Samba so far, but am concerned that it may have broken Samba somewhere.

File size comparison after and before truncating ReportTemp table:
image

Before truncating the table:

After running TRUNCATE TABLE ReportTemp; in SMSS and adding an item to a ticket then closing it:
image

Output from Select Top 100 Rows command:

id is_old table_name table_code items appkey type timestamp
1 NULL Numerators N60 98E7F4BC3061_N60_22AAAAAABOCJE=5#Order Number Generator 98E7F4BC3061 update 1623197490
2 NULL Numerators N60 98E7F4BC3061_N60_11AAAAAABOCJI=4#Ticket Number Generator 98E7F4BC3061 update 1623197490
3 NULL AccountTransactionDocuments A5 98E7F4BC3061_A5_14120141202021-06-09T00:11:29.3370Ticket Transaction [4]1Admin 98E7F4BC3061 insert 1623197490
4 NULL AccountTransactions A9 98E7F4BC3061_A9_4769847698141202.151.000000000032101Sale Transaction [#4] 98E7F4BC3061 insert 1623197490
5 NULL AccountTransactions A9 98E7F4BC3061_A9_4769947699141200.131.000000000082101Michigan Tax 6% Transaction 98E7F4BC3061 insert 1623197490
6 NULL AccountTransactionValues A11 98E7F4BC3061_A11_943959439547698141201212021-06-09T00:11:29.3370.002.15-2.153Sale Transaction [#4] 98E7F4BC3061 insert 1623197490
7 NULL AccountTransactionValues A11 98E7F4BC3061_A11_943969439647698141201122021-06-09T00:11:29.3372.150.002.153Sale Transaction [#4] 98E7F4BC3061 insert 1623197490
8 NULL AccountTransactionValues A11 98E7F4BC3061_A11_943979439747699141201282021-06-09T00:11:29.3370.000.13-0.138Michigan Tax 6% Transaction 98E7F4BC3061 insert 1623197490
9 NULL AccountTransactionValues A11 98E7F4BC3061_A11_943989439847699141201122021-06-09T00:11:29.3370.130.000.138Michigan Tax 6% Transaction 98E7F4BC3061 insert 1623197490
12 NULL TicketEntities T94 98E7F4BC3061_T94_1102811028259200Table 17<Ticket_Id>13566</Ticket_Id> 98E7F4BC3061 insert 1623197490
10 NULL Tickets T95 98E7F4BC3061_T95_13566135662021-06-09T00:11:30.4032021-06-09T00:11:29Jtp5FqjzfkuoUHecnzMyGQ42021-06-09T00:11:29.3372021-06-09T00:11:29.4132021-06-09T00:11:29.3370002.282.28111Admin[][{D:/Date(1623211889380-0400)/,S:Restaurant,SN:Source,SV:},{D:/Date(1623211889385-0400)/,S:Admin,SN:Ticket Assignment,SV:},{D:/Date(1623211889419-0400)/,S:New Orders,SN:Status,SV:}][{C:Ticket Created,D:/Date(1623211889386-0400)/,L:Assigned to Admin,N:4,U:Admin},{C:Entity,D:/Date(1623211889391-0400)/,L:Table 17 (Restaurant),N:4,U:Admin},{C:Add,D:/Date(1623211889419-0400)/,L:1 x Cappuccino ($2.28),N:4,U:Admin}][]1.00000000000<TransactionDocument_Id>14120</TransactionDocument_Id>02.15Admin 98E7F4BC3061 insert 1623197490
11 NULL Orders O61 98E7F4BC3061_O61_4388043880135661111659CappuccinoNormal2.151.000101105Admin2021-06-09T00:11:29.4132021-06-09T00:11:29.41330obRnOsj5W0O83CFKPE7sfw[{AC:false,AT:8,RN:0,TN:Michigan Tax 6%,TR:6.00,TT:1}][{D:/Date(1623211889420-0400)/,OK:000000,S:New,SN:Status,SV:,U:1}] 98E7F4BC3061 insert 1623197490
13 NULL EntityStateValues E39 98E7F4BC3061_E39_531531592[{D:/Date(1623211890451-0400)/,S:New Orders,SN:Status}] 98E7F4BC3061 update 1623197490
14 NULL Orders O61 98E7F4BC3061_O61_4388043880135661111659CappuccinoNormal2.151.000111105Admin2021-06-09T00:11:29.4132021-06-09T00:11:29.41330obRnOsj5W0O83CFKPE7sfw[{AC:false,AT:8,RN:0,TN:Michigan Tax 6%,TR:6.00,TT:1}][{D:/Date(1623211890459-0400)/,OK:000000,S:Submitted,SN:Status,SV:,U:1}] 98E7F4BC3061 update 1623197490
15 NULL Tickets T95 98E7F4BC3061_T95_13566135662021-06-09T00:11:30.4602021-06-09T00:11:29Jtp5FqjzfkuoUHecnzMyGQ42021-06-09T00:11:29.3372021-06-09T00:11:29.4132021-06-09T00:11:29.3370002.282.28111Admin[][{D:/Date(1623211889380-0400)/,S:Restaurant,SN:Source,SV:},{D:/Date(1623211889385-0400)/,S:Admin,SN:Ticket Assignment,SV:},{D:/Date(1623211890448-0400)/,S:Unpaid,SN:Status,SV:}][{C:Ticket Created,D:/Date(1623211889386-0400)/,L:Assigned to Admin,N:4,U:Admin},{C:Entity,D:/Date(1623211889391-0400)/,L:Table 17 (Restaurant),N:4,U:Admin},{C:Add,D:/Date(1623211889419-0400)/,L:1 x Cappuccino ($2.28),N:4,U:Admin}][]1.00000000000<TransactionDocument_Id>14120</TransactionDocument_Id>02.15Admin 98E7F4BC3061 update 1623197490

ReportTemp is for Metrik where it temporarily stores your transaction history before uploading.

If you’re not using Metrik be sure to uninstall SambaConnect.

Here’s a SQL script to remove all the triggers so no more entries are made in ReportTemp:

metrik_removal.zip (2.7 KB)

As always, backup your database before running.

5 Likes

Yeah I had the same issue before, once you install Metrik it adds those triggers. It’s safe to truncate those tables and drop the ReportTemp table, as well as remove the triggers. I did it manually before but I’m sure @Memo’s script will work better

2 Likes

This is really good to know, thanks guys!