How can I increase performance for select in select statement
SQL Fiddle

with items as (
    select registered, category_id
    from items
    where
        category_id is not null
        and
        registered &lt; '2013-05-02'
), items_restricted as (
    select registered, category_id
    from items
    where registered &gt;= '2013-05-01'
), category_id as (
    select distinct category_id
    from items_restricted
)
select distinct ir.registered, ir.category_id, "value"
from
    items_restricted ir
    inner join
    (
        select
            category_id, count(*) as value
        from items
        where exists (
            select category_id
            from category_id
            where category_id = items.category_id
        )
        group by category_id
    ) s using(category_id)
order by registered, category_id