将引用网址保存到数据库中

发布于 2024-09-08 15:37:39 字数 277 浏览 5 评论 0原文

我编写了一些代码,提供有关网站访问者的统计信息(例如“Google Analytics”),

我有一个包含refererID、refererURL 列的REFERER 表。 RefererURL 包含整个 url,包括参数。

其他表(例如统计表)通过refererID 列引用该表。

这在数据库存储空间方面效率不高。

我如何以不同的方式保存引用 URL 以节省尽可能多的空间?

谢谢 亚龙

I have written some code that provides statistical information about visitors to a website (like "Google Analytics")

I have a REFERER table with refererID, refererURL columns.
The refererURL contains the whole url, including the parameters.

other tables, such as the statistics table, refer to this table by the refererID column.

This is not efficient in terms of database storage space.

How could I save the referer URL differently to save as much space as I can?

Thank you
Yaron

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风吹过旳痕迹 2024-09-15 15:37:39

您可以在插入查询参数之前从 URL 中删除查询参数,并将它们保存在单独的表中,然后在审核表(对引用进行计数)中仅存储refererID 和引用日期。这将使您的推荐数据标准化。我会犹豫是否要进一步这样做,因为您将开始丢失信息,但您可能还想保留(在单独的列中)引用站点的主机部分,以便更轻松地通过“计算统计数据”网站”的未来。

You could strip the query parameters from the urls before inserting them and keep them in a separate table then in your audit table (that counts references) store only the refererID and the date of the reference. This would normalize your referral data. I'd be hesitant to go any further than this as you'll start to lose information, but you might want to also keep (in a separate column) just the host part of the referring site to make it easier to calculate statistics by "site" in the future.

病女 2024-09-15 15:37:39

我认为你的做法很好。存储在2010年已经不是什么大问题了。

你应该更多地考虑性能。

I think you approach is fine. Storage is not a big deal in 2010.

You should consider performances a lot more.

奢欲 2024-09-15 15:37:39

我建议分别存储域、路径和查询。该域名将得到大量重用,尤其是来自所有 Google 流量的重用。

当显示分析数据时,您通常会显示发送流量的站点,而当深入查看信息时,您将显示发送流量的更具体的 URL。

I would recommend storing the domain, path, and query each separately. The domain will get a lot of reuse, especially from all of the Google traffic.

When displaying analytics data you will normally show the site which sent the traffic and when drilling down into the information you will display the more specific URL which sent the traffic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文