Commit graph

22 commits

Author SHA1 Message Date
Yorick Peterse
054f2f98ed Faster way of obtaining latest event update time
Instead of using MAX(events.updated_at) we can simply sort the events in
descending order by the "id" column and grab the first row. In other
words, instead of this:

    SELECT max(events.updated_at) AS max_id
    FROM events
    LEFT OUTER JOIN projects   ON projects.id   = events.project_id
    LEFT OUTER JOIN namespaces ON namespaces.id = projects.namespace_id
    WHERE events.author_id IS NOT NULL
    AND events.project_id IN (13083);

we can use this:

    SELECT events.updated_at AS max_id
    FROM events
    LEFT OUTER JOIN projects   ON projects.id   = events.project_id
    LEFT OUTER JOIN namespaces ON namespaces.id = projects.namespace_id
    WHERE events.author_id IS NOT NULL
    AND events.project_id IN (13083)
    ORDER BY events.id DESC
    LIMIT 1;

This has the benefit that on PostgreSQL a backwards index scan can be
used, which due to the "LIMIT 1" will at most process only a single row.
This in turn greatly speeds up the process of grabbing the latest update
time. This can be confirmed by looking at the query plans. The first
query produces the following plan:

    Aggregate  (cost=43779.84..43779.85 rows=1 width=12) (actual time=2142.462..2142.462 rows=1 loops=1)
      ->  Index Scan using index_events_on_project_id on events  (cost=0.43..43704.69 rows=30060 width=12) (actual time=0.033..2138.086 rows=32769 loops=1)
            Index Cond: (project_id = 13083)
            Filter: (author_id IS NOT NULL)
    Planning time: 1.248 ms
    Execution time: 2142.548 ms

The second query in turn produces the following plan:

    Limit  (cost=0.43..41.65 rows=1 width=16) (actual time=1.394..1.394 rows=1 loops=1)
      ->  Index Scan Backward using events_pkey on events  (cost=0.43..1238907.96 rows=30060 width=16) (actual time=1.394..1.394 rows=1 loops=1)
            Filter: ((author_id IS NOT NULL) AND (project_id = 13083))
            Rows Removed by Filter: 2104
    Planning time: 0.166 ms
    Execution time: 1.408 ms

According to the above plans the 2nd query is around 1500 times faster.
However, re-running the first query produces timings of around 80 ms,
making the 2nd query "only" around 55 times faster.
2015-11-18 13:02:43 +01:00
Douwe Maan
07101cfab6 Merge branch 'fix_issue_2906' into 'master'
+ and Titleize New Project button on dashboard

Hello there. Its my first merge request in open source world. So please be tolerant to me if i do something wrong.

I try to fix https://gitlab.com/gitlab-org/gitlab-ce/issues/2906

See merge request !1564
2015-10-14 12:14:31 +00:00
Чингиз Ауанасов
42fb52adf4 Use css style 2015-10-13 04:41:51 +06:00
Valery Sizov
d805c5dbb3 Add spellcheck=false to certain input fields 2015-10-12 12:54:54 +03:00
Чингиз Ауанасов
a972ce17ca + and Titleize New Project button on dashboard 2015-10-10 14:07:12 +06:00
Drew Blessing
788a3f9b94 Add last push widget to starred projects dashboard 2015-10-01 15:17:32 -05:00
Dmitriy Zaporozhets
145d933880
Merge branch 'projects'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-28 13:42:41 +02:00
Andrey
12acf15c90 Project page Update
refactoring buttons, fixes for projects filter on the dashboard and
group page
2015-09-25 20:33:05 +02:00
Dmitriy Zaporozhets
353d426e4e
Show CI status on Your projects page and Starred projects page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-24 14:00:23 +02:00
Douwe Maan
1489d225d6 Move partial to right place and fix tests. 2015-09-08 15:14:14 +01:00
Douwe Maan
5d785457db Clean up overlap between dashboard and explore.
- Split up SnippetsController into separate dashboard and explore sections.
- Use consistent page titles, header titles and sidebars between dashboard and explore sections when signed in or not.
2015-09-08 14:49:20 +01:00
Dmitriy Zaporozhets
0145e8ea21
Set page title based on content in dashboard area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-03 21:53:55 +02:00
Dmitriy Zaporozhets
5bbe6c4d54
Split starred projects list and activity in same way like we did with your projects
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-02 19:17:04 +02:00
Dmitriy Zaporozhets
b54358b457
Refactor project list rendering
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-26 22:44:02 +02:00
Dmitriy Zaporozhets
735978388f
Increase width of sidebar for several pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-26 10:36:08 +02:00
Dmitriy Zaporozhets
7569010bc3
Fix tests and last push widget
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-25 16:36:54 +02:00
Dmitriy Zaporozhets
b1c1a3d3cc
Refactor sidebar navigation for dashboard
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-20 10:59:05 +02:00
Douwe Maan
26ad250989 Add a page title to every page. 2015-04-30 19:12:15 +02:00
Sullivan SENECHAL
f28f5e49f6 Fix wrong placement of show-aside link 2015-04-27 00:43:02 +02:00
Stan Hu
8ce69bdc8e Fix typo 2015-04-11 21:13:14 -07:00
Dmitriy Zaporozhets
ba39ca9f4a Fix project name overflow on dashboard 2015-03-18 21:05:39 -07:00
Dmitriy Zaporozhets
d36ee3190a Add starred projects page to dashboard 2015-03-09 14:12:03 -07:00