Skip to content

Commit 48d364a

Browse files
committed
stuff
1 parent 82680b3 commit 48d364a

14 files changed

+1926
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This repository contains the code used to analyze the extension ecosystems of PostgreSQL, MySQL/MariaDB, SQLite, Redis, and DuckDB. The code for each of these systems and the instructions on how to run the analysis scripts can be found in their respective directories, except the PostgreSQL index-type analysis, which is included as a submodule.
44

5-
Additionally, we have included our the CSVs used to run our plot scripts and the plot scripts themselves in this repository.
5+
Additionally, we have included our the CSVs used to run our plot scripts and the plot scripts themselves in the `plot_scripts` directory.
66

77
Feel free to submit PRs and offer feedback, we would love to hear it!
88

plot_scripts/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Plot Scripts
2+
This directory contains the scripts used to generate the plots in our paper.
3+
4+
There are two scripts:
5+
- `plots.py`: generates the histograms and bar graphs
6+
- `compatibility_hot_graph.py`: generates the compatibility hot graph (Figure 5 in the paper)
7+
8+
To run these scripts, `python3 plots.py` and `python3 compatibility_hot_graph.py` should work as intended. The scripts' dependencies are `matplotlib` and `pandas`.
+228
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
import csv
2+
import numpy as np
3+
import pandas as pd
4+
import matplotlib.pyplot as plt
5+
6+
sorted_values = [
7+
"auth_delay",
8+
"basebackup_to_shell",
9+
"auto_explain",
10+
"pg_log_userqueries",
11+
"dont_drop_db",
12+
"plv8",
13+
"sslinfo",
14+
"adminpack",
15+
"basic_archive",
16+
"intagg",
17+
"pgjwt",
18+
"uuid-ossp",
19+
"old_snapshot",
20+
"pg_buffercache",
21+
"pg_prewarm",
22+
"pg_proctab",
23+
"pgrowlocks",
24+
"pgtap",
25+
"tcn",
26+
"wal2json",
27+
"xml2",
28+
"passwordcheck",
29+
"pg_partman",
30+
"orafce",
31+
"pgfincore",
32+
"test_decoding",
33+
"dblink",
34+
"dict_int",
35+
"fuzzystrmatch",
36+
"lo",
37+
"dict_xsyn",
38+
"hypopg",
39+
"pg_freespacemap",
40+
"pg_variables",
41+
"pg_visibility",
42+
"pgcrypto",
43+
"pgstattuple",
44+
"tablefunc",
45+
"tsm_system_time",
46+
"amcheck",
47+
"pageinspect",
48+
"pg_surgery",
49+
"pg_wait_sampling",
50+
"tsm_system_rows",
51+
"unaccent",
52+
"jsonb_plpython3u",
53+
"logerrors",
54+
"pg_walinspect",
55+
"bool_plperl",
56+
"jsonb_plperl",
57+
"pgtt",
58+
"shared_ispell",
59+
"file_fdw",
60+
"imcs",
61+
"pg_qualstats",
62+
"hstore_plpython3u",
63+
"ltree_plpython3u",
64+
"pg_ivm",
65+
"plprofiler",
66+
"citext",
67+
"postgres_fdw",
68+
"pg_trgm",
69+
"hll",
70+
"ip4r",
71+
"vops",
72+
"hstore_plperl",
73+
"pg_repack",
74+
"pgaudit",
75+
"hstore",
76+
"intarray",
77+
"ltree",
78+
"cube",
79+
"bloom",
80+
"btree_gist",
81+
"pg_stat_statements",
82+
"prefix",
83+
"seg",
84+
"btree_gin",
85+
"pg_bigm",
86+
"pg_hint_plan",
87+
"vector",
88+
"isn",
89+
"lsm3",
90+
"pg_show_plans",
91+
"citus",
92+
"pg_tle",
93+
"pgsentinel",
94+
"pg_cron",
95+
"pg_stat_kcache",
96+
"pg_query_rewrite",
97+
"tds_fdw",
98+
"earthdistance",
99+
"pg_stat_monitor",
100+
"timescaledb",
101+
"pg_queryid",
102+
"pgextwlist",
103+
]
104+
105+
abc_order_list = sorted_values.copy()
106+
abc_order_list.sort()
107+
108+
# Removing pgextwtlist
109+
sorted_values.pop()
110+
num_extensions = len(sorted_values)
111+
112+
compatibility_file = open("csvs/compatibility_results.csv", "r")
113+
compatibility_dict = {}
114+
115+
csv_reader = csv.reader(compatibility_file, delimiter=',')
116+
line_count = 0
117+
118+
yes_count = 0
119+
no_count = 0
120+
for row in csv_reader:
121+
if line_count > 0:
122+
#print(row)
123+
second_extension = row[0]
124+
for i in range(1, len(row)):
125+
first_extension = abc_order_list[i-1]
126+
#print(first_extension + ", " + second_extension)
127+
if first_extension != second_extension:
128+
val = False
129+
if row[i] == "yes":
130+
val = True
131+
yes_count += 1
132+
elif row[i] == "no":
133+
no_count += 1
134+
135+
#print(val)
136+
compatibility_dict[(first_extension, second_extension)] = val
137+
138+
line_count += 1
139+
140+
index_type_df = pd.read_csv('../../analysis-scripts/csvs/index_type_results.csv')
141+
for _, row in index_type_df.iterrows():
142+
type_extn = row['Type']
143+
index_extn = row['Index']
144+
compatible_val = row['Compatible']
145+
146+
if compatible_val == False:
147+
compatibility_dict[(type_extn, index_extn)] = False
148+
compatibility_dict[(index_extn, type_extn)] = False
149+
150+
151+
image = np.zeros((num_extensions, num_extensions, 3), dtype=np.uint8)
152+
153+
#BOUND_IDX = 51
154+
for first_idx in range(num_extensions):
155+
for second_idx in range(num_extensions):
156+
first_extn = sorted_values[first_idx]
157+
second_extn = sorted_values[second_idx]
158+
if first_extn == second_extn:
159+
image[first_idx, second_idx] = (255,244,204)
160+
else:
161+
val = compatibility_dict[(first_extn, second_extn)]
162+
if val:
163+
image[first_idx, second_idx] = (184,228,204)
164+
else:
165+
image[first_idx, second_idx] = (232,0,11)
166+
#if first_idx <= BOUND_IDX and second_idx <= BOUND_IDX:
167+
#print((first_idx, second_idx))
168+
169+
def is_cond(extn):
170+
return extn == "pg_repack" or extn == "prefix"
171+
172+
count = 0
173+
small_image = np.zeros((20, 20, 3), dtype=np.uint8)
174+
for first_idx in range(20):
175+
for second_idx in range(20):
176+
first_extn = sorted_values[first_idx + num_extensions - 20]
177+
second_extn = sorted_values[second_idx + num_extensions - 20]
178+
if first_extn == second_extn:
179+
small_image[first_idx, second_idx] = (255,244,204)
180+
else:
181+
val = compatibility_dict[(first_extn, second_extn)]
182+
if val:
183+
small_image[first_idx, second_idx] = (184,228,204)
184+
else:
185+
print(second_extn)
186+
small_image[first_idx, second_idx] = (232,0,11)
187+
188+
print(count)
189+
190+
def small_graph():
191+
_, ax = plt.subplots(figsize=(8, 8))
192+
ax.imshow(small_image, interpolation='nearest')
193+
194+
# Hide grid lines
195+
ax.grid(False)
196+
197+
font_size = 10
198+
print(sorted_values[-20:])
199+
ax.set_yticks([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
200+
ax.set_yticklabels(sorted_values[-20:], fontsize=font_size)
201+
ax.set_xticks([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
202+
ax.set_xticklabels(sorted_values[-20:], rotation=10, fontsize=font_size)
203+
ax.tick_params(axis='both', which='both', length=0) # Hides both major and minor ticks
204+
ax.spines['top'].set_visible(False) # Hide the top spine
205+
ax.spines['right'].set_visible(False) # Hide the right spine
206+
ax.spines['bottom'].set_visible(False) # Hide the bottom spine
207+
ax.spines['left'].set_visible(False) # Hide the left spine
208+
209+
plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right')
210+
211+
# Save or show the plot
212+
plt.savefig("small_test.pdf", bbox_inches='tight', pad_inches=0)
213+
plt.show()
214+
215+
def big_graph():
216+
_, ax = plt.subplots(figsize=(8, 8))
217+
ax.imshow(image, interpolation='nearest')
218+
219+
# Hide grid lines
220+
ax.grid(False)
221+
ax.set_axis_off()
222+
223+
# Save or show the plot
224+
plt.savefig("big_test.pdf", bbox_inches='tight', pad_inches=0)
225+
plt.show()
226+
227+
small_graph()
228+
big_graph()

plot_scripts/csvs/compatibility.csv

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
data
2+
4.21
3+
8.42
4+
1.58
5+
2.11
6+
1.58
7+
4.21
8+
7.37
9+
8.95
10+
12.63
11+
14.74
12+
11.58
13+
30.0
14+
13.68
15+
7.37
16+
7.37
17+
7.89
18+
4.21
19+
82.11
20+
11.05
21+
7.37
22+
13.68
23+
14.21
24+
12.11
25+
7.89
26+
11.05
27+
4.74
28+
11.58
29+
10.0
30+
20.0
31+
8.95
32+
9.47
33+
7.37
34+
8.95
35+
19.47
36+
12.63
37+
12.11
38+
5.79
39+
5.26
40+
7.89
41+
5.26
42+
19.47
43+
5.79
44+
37.37
45+
7.37
46+
19.47
47+
11.05
48+
2.11
49+
6.84
50+
5.79
51+
5.79
52+
10.53
53+
44.74
54+
87.37
55+
15.26
56+
24.74
57+
38.95
58+
83.68
59+
17.37
60+
7.89
61+
32.11
62+
12.63
63+
7.37
64+
7.37
65+
7.89
66+
8.42
67+
14.74
68+
7.37
69+
91.58
70+
6.32
71+
5.26
72+
5.79
73+
35.79
74+
7.37
75+
5.79
76+
8.95
77+
12.63
78+
3.16
79+
12.11
80+
9.47
81+
15.26
82+
14.74
83+
8.95
84+
4.21
85+
7.37
86+
5.79
87+
5.79
88+
6.32
89+
87.37
90+
7.89
91+
7.37
92+
7.89
93+
5.26
94+
7.37
95+
8.42
96+
4.74
97+
5.79

0 commit comments

Comments
 (0)