Re: Slow query with a lot of data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Well, you're getting the database to read the entire contents of the
domain_categories table in order. That's 12 million rows - a fair
amount of work.
You may find that removing the "user = 1337" constraint doesn't make
the query much slower - that's where you get a big win by clustering
on domain. You might also want to cluster the results table on domain.
Running the query for more than one user is indeed not much slower.
That's what I need. I'm clustering the results table on domain right
now. But why is this better than clustering it on "user"?
If you want the results for just one user, it would be very helpful
to have a user column on the domain_categories table, and an index
on that column. However, that will slow down the query for all users
a little.
A row in domain_categories can belong to more than one user. But I
don't need to run this query for only one user anyway.
Thanks so far,
[Postgresql General]
[Postgresql PHP]
[PHP Users]
[PHP Home]
[PHP on Windows]
[Kernel Newbies]
[PHP Classes]
[PHP Books]
[PHP Databases]
[Yosemite]