php - How to store url in database and generate unque id -
i want create application using php , mysql.
assume making api call , getting list of urls. want store urls , each url should have 1 uniqe id( ie. number) can pass id page , can url db.
assume made api call got 5 urls keyword "xyz" , got following urls , respective titles
google.com/abc1.html title1 google.com/abc2.html title2 google.com/abc3.html title3 google.com/abc4.html title4
so want generate unique id of each url
id1 google.com/abc1.html title1 id2 google.com/abc2.html title2 id3 google.com/abc3.html title3 id4 google.com/abc4.html title4
constraints url should unique
database can hold around 12lacs urls.
can please guide me how implement that? give optimization guide lines
thanks
12lacs = 1.2 million, right?
for can use regular unsigned integer auto increment;
create table urls ( id int unsigned not null auto_increment, url varchar(255) not null unique, title varchar(255) not null, primary key(id) );
an unsigned integer can hold value 4 294 967 295.
Comments
Post a Comment