Builds on windows again
This commit is contained in:
parent
33cf39b799
commit
bebb3391c3
160 changed files with 138 additions and 117 deletions
144
pglab/ExplainTreeModelItem.h
Normal file
144
pglab/ExplainTreeModelItem.h
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
//#include <QVariant>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace Json {
|
||||
|
||||
class Value;
|
||||
|
||||
}
|
||||
class ExplainTreeModelItem;
|
||||
typedef std::shared_ptr<ExplainTreeModelItem> ExplainTreeModelItemPtr;
|
||||
|
||||
/* Columns for tree
|
||||
* 0. explain text
|
||||
* 1. exclusive times
|
||||
* 2. inclusive
|
||||
* 3. rows x
|
||||
* 4. rows
|
||||
* 5. loops
|
||||
*/
|
||||
|
||||
/** \brief Class for the nodes in the QueryExplainModel
|
||||
*/
|
||||
class ExplainTreeModelItem: public std::enable_shared_from_this<ExplainTreeModelItem> {
|
||||
public:
|
||||
typedef std::shared_ptr<ExplainTreeModelItem> ItemPtr;
|
||||
|
||||
|
||||
ExplainTreeModelItem();
|
||||
~ExplainTreeModelItem();
|
||||
|
||||
ExplainTreeModelItem(const ExplainTreeModelItem &rhs) = delete;
|
||||
ExplainTreeModelItem &operator=(const ExplainTreeModelItem &rhs) = delete;
|
||||
|
||||
void appendChild(ItemPtr child);
|
||||
|
||||
ExplainTreeModelItemPtr child(int row);
|
||||
int childCount() const;
|
||||
// int columnCount() const;
|
||||
// QVariant data(int column) const;
|
||||
int row() const;
|
||||
void setParent(ItemPtr parent);
|
||||
ItemPtr parent();
|
||||
|
||||
|
||||
void setNodeType(QString nt);
|
||||
const QString& nodeType() const;
|
||||
void setStrategy(QString strat);
|
||||
const QString& strategy() const;
|
||||
void setJoinType(QString jointype);
|
||||
QString joinType() const;
|
||||
void setStartupCost(float cost);
|
||||
void setTotalCost(float cost);
|
||||
void setEstimatedRows(long long estimated);
|
||||
long long estimatedRows() const;
|
||||
void setPlanWidth(int width);
|
||||
void setActualStartupTime(float timems);
|
||||
void setActualTotalTime(float timems);
|
||||
float actualTotalTime() const;
|
||||
void setActualRows(long long rowcount);
|
||||
long long actualRows() const;
|
||||
void setActualLoops(int loopcount);
|
||||
int actualLoops() const;
|
||||
|
||||
void setRelationName(QString n);
|
||||
void setAlias(QString a);
|
||||
void setScanDirection(QString dir);
|
||||
void setIndexName(QString idxname);
|
||||
void setIndexCondition(QString idxcond);
|
||||
void setIndexRecheck(QString idxrecheck);
|
||||
void setFilter(QString filter);
|
||||
void setHashCondition(QString condition);
|
||||
void setSortKey(QString key);
|
||||
void setSortMethod(QString method);
|
||||
void setSortSpaceUsed(int space);
|
||||
void setSortSpaceType(QString type);
|
||||
|
||||
/** ActualTotalTime minus the actual total time of it's children */
|
||||
float exclusiveTime() const;
|
||||
float inclusiveTime() const;
|
||||
float estimateError() const;
|
||||
QString detailString() const;
|
||||
private:
|
||||
std::vector<ItemPtr> m_childItems;
|
||||
std::weak_ptr<ExplainTreeModelItem> m_parentItem;
|
||||
|
||||
QString m_nodeType;
|
||||
QString m_strategy;
|
||||
QString m_joinType;
|
||||
float m_startupCost = 0.f;
|
||||
float m_totalCost = 0.f;
|
||||
long long m_estimatedRows = 0;
|
||||
int m_planWidth = 0;
|
||||
float m_actualStartupTime = 0.f;
|
||||
float m_actualTotalTime = 0.f;
|
||||
long long m_actualRows = 0;
|
||||
int m_actualLoops = 0;
|
||||
|
||||
QString m_relationName;
|
||||
QString m_alias;
|
||||
QString m_scanDirection;
|
||||
QString m_indexName;
|
||||
QString m_indexCondition;
|
||||
QString m_indexRecheck;
|
||||
QString m_filter;
|
||||
QString m_hashCondition;
|
||||
QString m_sortKey;
|
||||
QString m_sortMethod;
|
||||
int m_sortSpaceUsed = -1;
|
||||
QString m_sortSpaceType;
|
||||
|
||||
// "Output": ["f1.id", "f1.program", "f1.version", "f1.lic_number", "f1.callstack_crc_1", "f1.callstack_crc_2", "array_agg(f2.id)"],
|
||||
// "Group Key": ["f1.id"],
|
||||
// "Shared Hit Blocks": 694427,
|
||||
// "Shared Read Blocks": 0,
|
||||
// "Shared Dirtied Blocks": 0,
|
||||
// "Shared Written Blocks": 0,
|
||||
// "Local Hit Blocks": 0,
|
||||
// "Local Read Blocks": 0,
|
||||
// "Local Dirtied Blocks": 0,
|
||||
// "Local Written Blocks": 0,
|
||||
// "Temp Read Blocks": 0,
|
||||
// "Temp Written Blocks": 0
|
||||
|
||||
// "Parent Relationship": "Outer",
|
||||
|
||||
};
|
||||
|
||||
class ExplainRoot {
|
||||
public:
|
||||
using SPtr = std::shared_ptr<ExplainRoot>;
|
||||
static SPtr createFromJson(Json::Value &json);
|
||||
|
||||
ExplainTreeModelItemPtr plan;
|
||||
float planningTime = 0.f;
|
||||
// Triggers???
|
||||
float executionTime = 0.f;
|
||||
float totalRuntime = 0.f;
|
||||
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue