dkirkby / bossdata

Tools for accessing SDSS BOSS data
MIT License
1 stars 3 forks source link

Swap out call to "...COUNT(*)..." in meta.Database.init #85

Open dcunning11235 opened 9 years ago

dcunning11235 commented 9 years ago

Should speed things up if only accessing the index columns; confirm and change if needed.

dkirkby commented 9 years ago

Is the idea to change COUNT(*) to COUNT(PLATE) ? Have you tested whether this is any faster?

dcunning11235 commented 9 years ago

Yes, something like COUNT(PLATE); and no, need to test this.

I noticed because I had a query running for some time (with lots else going on, so generally slowing the machine down) and when I killed it, this is the statement it was executing. Count(*) should trigger a full table scan; Googling a bit on this confirms that. What I've read sounds... confused as to whether e.g. COUNT(PLATE) is better. But that should (so I claim/hope) only hit the index. Need to set up some tests to confirm.