TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Exploring Databases Visually

146 点作者 dmfay大约 4 年前

7 条评论

chunkyks大约 4 年前
I implemented a DB visualisation tool like this for sqlite3, also using graphviz. It&#x27;s called, unimaginatively, sqlite3todot [1]<p>The couple tricks it has that I really like are a) it shows the table itself [which isn&#x27;t uncommon], but also b) has the ability to group up tables, which for me turns out to be a devastatingly killer feature that no other tool has.<p>When I&#x27;m working on a schema [especially one I&#x27;ve not seen before], one of the things that drives me insane is not being able to say &quot;these six go together. Group them&quot;. Then you can simply look at arrows that enter or leave that grouping for your next exploration step. By the time I&#x27;m done, anything not-categorised stands out [it&#x27;s simply in the space between groups]; any boxes that have an excess of arrows between them can mean my mental model is wrong [or the schema has some nonoptimalities].<p>There&#x27;s an example here; it only has two groupings [&quot;input&quot; and &quot;output&quot;], but it immediately gets the point across: <a href="https:&#x2F;&#x2F;icculus.org&#x2F;~chunky&#x2F;stuff&#x2F;sqlite3_example&#x2F;sqliteschema&#x2F;complexexample.png" rel="nofollow">https:&#x2F;&#x2F;icculus.org&#x2F;~chunky&#x2F;stuff&#x2F;sqlite3_example&#x2F;sqlitesche...</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;chunky&#x2F;sqlite3todot" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;chunky&#x2F;sqlite3todot</a>
评论 #26696648 未加载
评论 #26696708 未加载
simonw大约 4 年前
I&#x27;ve been doing something similar to this using an Observable notebook - this one joins the sqlite_master table against the pragma_foreign_key_list() SQLite function and uses the returned data to show a DOT diagram:<p><a href="https:&#x2F;&#x2F;observablehq.com&#x2F;@simonw&#x2F;datasette-table-diagram" rel="nofollow">https:&#x2F;&#x2F;observablehq.com&#x2F;@simonw&#x2F;datasette-table-diagram</a><p>It defaults to showing the tables from my GitHub example database but you can paste in the URL to another Datasette to see that one visualized instead - try <a href="https:&#x2F;&#x2F;latest.datasette.io&#x2F;fixtures" rel="nofollow">https:&#x2F;&#x2F;latest.datasette.io&#x2F;fixtures</a> for example
tracyhenry大约 4 年前
As part of my research, I&#x27;m also building a new UI for exploring a database using data visualizations and an ER diagram. Here is a half-baked demo: <a href="http:&#x2F;&#x2F;mondial.kyrixdemo.live&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mondial.kyrixdemo.live&#x2F;</a><p>Hopefully the UI is self-explanatory - if not try clicking on visual objects to perform drill down, or search something in the top righthand corner.<p>The underlying dataset is a public DBMS called MONDIAL: <a href="https:&#x2F;&#x2F;www.dbis.informatik.uni-goettingen.de&#x2F;Mondial&#x2F;mondial-RS.pdf" rel="nofollow">https:&#x2F;&#x2F;www.dbis.informatik.uni-goettingen.de&#x2F;Mondial&#x2F;mondia...</a>
评论 #26699026 未加载
评论 #26699015 未加载
meesterdude大约 4 年前
I&#x27;m building a 3D database that lets you explore graph and relational data that you&#x27;ve created. For research or creating your own mind palaces - you can freely join &amp; filter collections of information. But it&#x27;s more like a 3D excel of sorts.
评论 #26710075 未加载
评论 #26695234 未加载
pm90大约 4 年前
Isn&#x27;t this what schemaspy does? <a href="http:&#x2F;&#x2F;schemaspy.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;schemaspy.org&#x2F;</a>
评论 #26694229 未加载
_wldu大约 4 年前
I love graphs (it was my favorite topic in algorithms) and I think they can be applied to many subjects to help us understand and visualize problems and systems better. In particular, I think graphs could really help network security monitoring efforts to quickly identify anomalies.<p>Also, graphviz is really cool.
JoelJacobson大约 4 年前
Foreign Keys are great!<p>Too bad they were not invented until SQL-89, and could thus not be considered when the JOIN syntax we all know was designed and formalized by ANSI in SQL-86.<p>Imagine if we could simply give the name of a foreign key, as an argument to JOIN, letting the query planner look up the foreign key columns, to do the join on.<p>The default names for foreign keys are not very user-friendly, due to the SQL standard unfortunate decision to require the foreign key name to be unique per namespace, and not just per table, which would have made more sense.<p>In PostgreSQL, foreign keys just need to be unique per table, so there we could give them names such as &quot;customer&quot; instead of &quot;rental_customer_id_fkey&quot;.<p>Imagine if we instead of:<p><pre><code> SELECT language.name, COUNT(*) FROM rental JOIN customer ON customer.customer_id = rental.customer_id JOIN address ON address.address_id = customer.address_id JOIN city ON city.city_id = address.city_id JOIN country ON country.country_id = city.country_id JOIN inventory ON inventory.inventory_id = rental.inventory_id JOIN film ON film.film_id = inventory.film_id JOIN language ON language.language_id = film.language_id WHERE country.country = &#x27;Sweden&#x27; GROUP BY language.name </code></pre> Would write something like:<p><pre><code> SELECT language.name, COUNT(*) FROM rental JOIN rental-&gt;rental_customer_id_fkey AS customer JOIN customer-&gt;customer_address_id_fkey AS address JOIN address-&gt;address_city_id_fkey AS city JOIN city-&gt;city_country_id_fkey AS country JOIN rental-&gt;rental_inventory_id_fkey AS inventory JOIN inventory-&gt;inventory_film_id_fkey AS film JOIN film-&gt;film_language_id_fkey AS language WHERE country.country = &#x27;Sweden&#x27; GROUP BY language.name </code></pre> After renaming the foreign keys:<p><pre><code> ALTER TABLE rental RENAME CONSTRAINT rental_customer_id_fkey TO customer; ALTER TABLE rental RENAME CONSTRAINT rental_inventory_id_fkey TO inventory; ALTER TABLE customer RENAME CONSTRAINT customer_address_id_fkey TO address; ALTER TABLE address RENAME CONSTRAINT address_city_id_fkey TO city; ALTER TABLE city RENAME CONSTRAINT city_country_id_fkey TO country; ALTER TABLE inventory RENAME CONSTRAINT inventory_film_id_fkey TO film; ALTER TABLE film RENAME CONSTRAINT film_language_id_fkey TO language; </code></pre> We could write this as:<p><pre><code> SELECT language.name, COUNT(*) FROM rental JOIN rental-&gt;customer JOIN customer-&gt;address JOIN address-&gt;city JOIN city-&gt;country JOIN rental-&gt;inventory JOIN inventory-&gt;film JOIN film-&gt;language WHERE country.country = &#x27;Sweden&#x27; GROUP BY language.name </code></pre> And if allowing such a &quot;foreign key operator&quot; to be chained, we could write:<p><pre><code> SELECT language.name, COUNT(*) FROM rental JOIN rental-&gt;customer-&gt;address-&gt;city-&gt;country JOIN rental-&gt;inventory-&gt;film-&gt;language WHERE country.country = &#x27;Sweden&#x27; GROUP BY language.name </code></pre> This is similar to &quot;4.9 Reference types&quot; in the SQL standard ISO&#x2F;IEC 9075-2:2016(E), but it wouldn&#x27;t require a separate REF column, it would merely use the existing foreign keys which we already have in well designed proper database schemas. We would just need to give them better names.<p>Q: How would we name foreign keys if there are two going to the same table?<p>A: Imagine having a &quot;users&quot; table with two columns &quot;child_user_id&quot; and &quot;parent_user_id&quot;, both referencing &quot;users&quot;. The foreign keys on such columns could simply be named &quot;child&quot; and &quot;parent&quot;.
评论 #26701497 未加载
评论 #26698663 未加载