Hi Liam, top tuning tip for every relational database is: indexes! I have adminstrated databases where data was 300 GB and created indexes 600 GB You may think thats useless redundant but ist definitively not. Rules for indexing: Does it make sense to create an index for a table with one or several douzends of entries? -> YES! Does it make sense to create an index that is optimized for certain queries? -> YES! Does it make sense to create an index, make the query and drop the index? -> YES Even with tables with billions of entries you should get answer times of less than a second! … if you have a good index: date for example where the database engine plays ist full potental. For example see: https://www.enterprisedb.com/postgres-tutorials/overview-postgresql-indexes Which indexes do you have? best, A
Von: liam saffioti <liam.saffiotti@xxxxxxxxx>
Hello Team, I have a problem with a query that consumes a long time. The query' execution plan is : EXPLAIN ANALYZE SELECT x."HistoryId", x."SlaDefinition" FROM "T_CMN_SLAHISTORY" AS x WHERE x."DefinitionId" = '302'; But, the query execution time was 43min 11seconds in the morning in pgbadger report. I don't understand why the query is taking so long. Can you guide me? Thank you so much. |