# Timeports database debug Dzisiaj odnotowaliśmy kilka pików na produkcyjnej bazie danych timeportsów. Największe nieprawidłowości zostały zaobserwowane w sekcji podróżach służbowych jit-internal-postgres-prod database ![jit-internal-postgres-prod diagram](https://i.imgur.com/VNPaGDx.png) ### timeports-backend-7bd485ccb7-sd7l9 logs `Call: SELECT ID, ACCOMMODATIONRESERVATIONINFORMATION, ACCOMMODATIONRESERVATIONMADEBY, ADVANCE, ADVANCEDESCRIPTION, BACKFROMOTHERLOCATION, CITY, CONTRACTTYPE, COPIEDFROM, COPIEDFROMID, COUNTRY, CREATIONDATETIME, ENDTIME, ESTIMATEDCOSTSOFSTAY, ESTIMATEDCOSTSOFSTAYCURRENCY, FOREIGNBUSINESSTRIP, INSURANCEBOUGHT, INSURANCEBUYBY, MAILSENT, MEALSPROVIDED, MODIFICATIONDATETIME, NAME, NUMBEROFBREAKFASTS, NUMBEROFDINNERS, NUMBEROFNIGHTS, NUMBEROFSUPPERS, OTHERINFORMATION, OTHERLOCATIONNAME, OTHERSTAYPLACE, PERSONALIDENTITY, RESERVATIONINFORMATION, STARTTIME, STATUS, STAYINONEPLACE, SUGGESTEDPLACETOSTAY, SURNAME, TITLE, TRAVELFROM, TRAVELRESERVATIONMADEBY, TRAVELTO, accountId, clientId, projectId FROM BUSINESSTRIP WHERE (MAILSENT = ?) ORDER BY ENDTIME DESC, STARTTIME DESC` Error Code: 0 ### postgresql-2022-06-02_110000 | jit-internal-postgres-prod | Server logs Azure Database for PostgreSQL single server ``` 2022-06-02 11:18:17 UTC-62989c79.56d8-LOG: connection received: host=10.32.0.206 port=12547 pid=22232 2022-06-02 11:18:17 UTC-62989c79.56d8-LOG: connection authorized: user=wejitpreproddatabase=jitwejitpreprod SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, compression=off) 2022-06-02 11:19:56 UTC-62989cdc.56e0-LOG: connection received: host=10.32.0.35 port=8833 pid=22240 2022-06-02 11:19:56 UTC-62989cdc.56e0-LOG: connection authorized: user=wejitpreproddatabase=jitwejitpreprod SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, compression=off) 2022-06-02 11:20:01 UTC-62989ce1.56e8-LOG: connection received: host=127.0.0.1 port=59734 pid=22248 2022-06-02 11:20:01 UTC-62989ce1.56e8-LOG: connection authorized: user=azure_superuserdatabase=azure_sys SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, compression=off) 2022-06-02 11:20:01 UTC-62989ce1.56e8-ERROR: relation "dta.dta_input" does not exist at character 1114 2022-06-02 11:20:01 UTC-62989ce1.56e8-STATEMENT: select inp.GlobalSessionId as SessionId , coalesce(repdb.DatabaseName, '') as DatabaseName , inp.CreationTime as StartTime , coalesce(rec.StopTime, inp.CreationTime) as StopTime , extract(epoch from (now() - inp.CreationTime)) as AgeSec , coalesce(rec.FinishStatus, 2) as FinishStatus , coalesce(rec.EstPctImprovement, 0) as EstPctImprovement , coalesce(rec.EventWorkloadCount, 0) as EventWorkloadCount , coalesce(rec.EventTunedCount, 0) as EventTunedCount , coalesce(rec.StatementTunedCount, 0) as StatementTunedCount , coalesce(rec.IdxRecCount, 0) as IdxRecCount , coalesce(rec.Message, '') as Message , coalesce(reci.IdxID, 0) as IdxID , coalesce(reci.SchemaName, '') as SchemaName , coalesce(reci.TableName, '') as TableName , coalesce(array_to_string(reci.ColumnList, ',', ' '), '') as ColumnList , 'btree' as IndexType , coalesce(reci.Command, '') as Command , coalesce(rec.EstPctImprovement, 0) * (coalesce(reci.Benefit, 0) / coalesce(nullif(sum(coalesce(reci.Benefit, 0)) over (partition by reci.SessionId), 0), 1.0)) as Benefit , coalesce(reci.IndexSizeInMB, 0) as IndexSizeInMB from dta.DTA_input inp left join dta.dta_reports_database repdb on repdb.SessionId = inp.SessionId left join dta.DTA_rec rec on inp.SessionId = rec.SessionId left join dta.DTA_rec_idx reci on reci.SessionId = rec.SessionId where true order by rec.GlobalSessionId, reci.IdxID 2022-06-02 11:20:01 UTC-62989ce1.56e8-ERROR: relation "perfrec.dropindexrec" does not exist at character 656 2022-06-02 11:20:01 UTC-62989ce1.56e8-STATEMENT: select rec.SessionId , rec.DatabaseName , rec.Status , rec.StartTime , coalesce(rec.EndTime, now()) as EndTime , extract(epoch from (now() - rec.StartTime)) as AgeSec , coalesce(rec.Message, '') as Message , coalesce(reci.RecId, 0) as RecId , coalesce(reci.SchemaName, '') as SchemaName , coalesce(reci.TableName, '') as TableName , coalesce(reci.IndexName, '') as IndexName , coalesce(reci.ColumnList, '') as ColumnList , coalesce(reci.IndexType, '') as IndexType , coalesce(reci.Command, '') as Command , coalesce(reci.Benefit, 0) as Benefit , coalesce(reci.IndexSizeInMb, 0) as IndexSizeInMb , coalesce(reci.Reason, '') as Reason from perfrec.DropIndexRec rec left join perfrec.DropIndexRecIdx reci on reci.SessionId = rec.SessionId where true order by rec.SessionId, reci.RecId ``` ``` 2022-06-02 11:24:06 UTC-6298987f.3918-ERROR: function unaccent(text) does not exist at character 62 2022-06-02 11:24:06 UTC-6298987f.3918-HINT: No function matches the given name and argument types. You might need to add explicit type casts. 2022-06-02 11:24:06 UTC-6298987f.3918-STATEMENT: select company_dictionary.name from company_dictionary where unaccent(trim(lower(company_dictionary.name))) = unaccent(trim(lower($1))) or similarity(unaccent(company_dictionary.name), unaccent($2)) > 0.7 order by unaccent(trim(lower(company_dictionary.name))) = unaccent(trim(lower($3))) desc limit 5 ```